akserg / ng2-toasty

Angular2 Toasty component shows growl-style alerts and messages for your app.
MIT License
283 stars 102 forks source link

OnPush DetectionStrategy #68

Closed destus90 closed 7 years ago

destus90 commented 7 years ago

Does it real to use ng2-toasty with ChangeDetectionStrategy.OnPush? When i use OnPush, the message doesn`t dissappear after timeout. I inject ChangeDetectorRef service in your code , call ref.detectChanges() and everything was OK, but AoT fail.

destus90 commented 7 years ago
makeToastyNotification(type: string, title: string, msg: string) {
    const toastOptions: ToastOptions = {title, msg} as ToastOptions;
    this.toastyService[type](toastOptions);
    this.cd.markForCheck();
    setTimeout(() => {
      this.cd.markForCheck();
    }, this.toastyConfig.timeout);
  }

help me. Close.