Inaccurate error when `BrowserAnimationsModule` is loaded but the `@Component.animations` property is missing
See original GitHub issueπ bug report
Affected Package
I have no idea. Maybe is the rxjs/core?
Is this a regression?
no
Description
As the below code, which is work in the desktop browser. However, it is doesnβt work in the mobile browser. I find it is because of the subject.next() did not send successfully. It is happen when switch the chrmoe devtools to mobile mode ToastService.ts `
public subject = new Subject<ToastModel>();
constructor() {}
getToast = (toastId?: string): Observable<any> => {
return this.subject.asObservable();
};
success(message: string, keepAfterRouteChange = false) {
this.toast(ToastType.Success, message, keepAfterRouteChange);
}
toast(type: ToastType, message: string, keepAfterRouteChange = false)
{
this.keepAfterRouterChange = keepAfterRouteChange;
// I think is this code doesn't work
this.subject.next(<ToastModel>{ type: type, message: message });
}`
toast.component.ts `
constructor(private toastService: ToastService) {
}
ngOnInit() {
this.toastService.getToast().subscribe((toast: ToastModel) => {
// because in here can not catch the data from subject.next()
console.log('toast')
if(!toast) {
this.toasts = [];
return;
}
this.toasts.push(toast);
})
this.toastService.subject.subscribe((toast: ToastModel) => {
console.log(toast);
})
}`
Above those codes is work in the desktop browser, However, it is not work in the mobile browser
π¬ Minimal Reproduction
https://stackblitz.com/edit/angular-nmpadm?file=src%2Fapp%2Fapp.component.ts
π₯ Exception or Error
Hope can support in mobile browser
π Your Environment
Angular Version:
Angular CLI: 6.2.5
Node: 8.12.0
OS: darwin x64
Angular: 6.1.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.8.5
@angular-devkit/build-angular 0.8.5
@angular-devkit/build-optimizer 0.8.5
@angular-devkit/build-webpack 0.8.5
@angular-devkit/core 0.8.5
@angular-devkit/schematics 0.8.5
@angular/cli 6.2.5
@ngtools/webpack 6.2.5
@schematics/angular 0.8.5
@schematics/update 0.8.5
rxjs 6.2.2
typescript 2.9.2
webpack 4.20.2
Anything else relevant?
chrome version 70.0.3538.110
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Need BrowserAnimationsModule in Angular but gives error in ...
1 Answer 1 Β· 1) Remove any reference to BrowserAnimationsModule from app.module.ts and create a separate app.browser.module. Β· 2) ImportΒ ...
Read more >Introduction to Angular animations
Angular's animation system is built on CSS functionality, which means you can animate any property that the browser considers animatable.
Read more >Why your Angular App is not Working: 11 common Mistakes
This error indicates, that the angular Forms Module has not been imported ... RouterModule BrowserAnimationsModule / NoopAnimationsModule.
Read more >Angular animation trap - David Votrubec
But their error messages can be quite misleading. ... are trying to use @detailExpand, but there is no animation property on the component....
Read more >Stop Using Shared Material Module - Angular inDepth
In this blog post, I will talk about a mistake I have made and have seen ... One more change is needed in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, the problem in your example is not in observables nor subjects. Itβs in animations - as you can see in error console. If you remove
[@slideDownAnimation]="isShow"
from yourtoast.component.html
your example works - even on phone as you can see here: https://stackblitz.com/edit/angular-72dne4.This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.