dominique-mueller / angular-notifier

A well designed, fully animated, highly customizable, and easy-to-use notification library for your Angular application.
https://www.npmjs.com/package/angular-notifier
MIT License
247 stars 68 forks source link

Question: When is the notifier ready? #119

Closed vajnorcan closed 5 years ago

vajnorcan commented 5 years ago

Hi,

I'm trying to show the notification when the application is checking any existing user credentials right after the the app starts. I've added the subscription to the auth-service isLoading$ observable in the app-component 's onInit

ngOnInit() {   
    // Make sure you display the notification when the user check is happening
    this.authService.isLoading$.subscribe(isLoading => {
      if (isLoading) {
        this.notifierService.notify('info', 'Checking user credentials...', this.authLoadingMsg);
      }
      else {
        this.notifierService.hide(this.authLoadingMsg);
      }
    });
  }

but it seems to screw the notifier, as no notifications are shown afterwards. If I delay this subscription, then it works all fine, but somewhat hard-coding the delay is a bad solution I'd say.

There must be something happening that is not yet ready and invalidates the notifier, hence I'd like to get an advice on when/where is the best place to make sure/check if the notifier is actually ready

Thank you!

kylecannon commented 5 years ago

Having the same issue too.

vunb commented 5 years ago

I got the same issue

dominique-mueller commented 5 years ago

I can reproduce the issue, looking into a fix.

dominique-mueller commented 5 years ago

Release with 6.0.1. Not that the 6.x releases of angular-notifier require an upgrade to Angular 8.