question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
luki215commented, Dec 20, 2018

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 your toast.component.html your example works - even on phone as you can see here: https://stackblitz.com/edit/angular-72dne4.

0reactions
angular-automatic-lock-bot[bot]commented, May 27, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found