#check if label is already used in toast

5 messages · Page 1 of 1 (latest)

stark hull
#

I have a toast service that should issue a toast if there is an error. Now the error pops up all the time when I write something wrong in the input field. How can I compare to the label of my toast service and set a timer to only trigger every second, but only in the service with the same label?

this.NotificationService = this.NotificationService.notificationToasts$.subscribe(
      (newToastToShow: Toast) => {
          this.showToast(newToastToShow);
          this.changeDetectorRef.markForCheck();
      }
    );
  }
#

I need something like:

this.NotificationService = this.NotificationService.notificationToasts$.subscribe(
if (newToastToShow.label === ???){
      (newToastToShow: Toast) => {
          this.showToast(newToastToShow);
          this.changeDetectorRef.markForCheck();
      }
     }
    );
  }
#

??? = this one i search now 😄

mint berry
#

¿What? this.NotificationService = this.NotificationService.notificationToasts$.subscribe No

#

First don't overwrite the service with a Subscription... and the fact that isn't a type error is terrifying