Put in order · Angular course · Module 7: RxJS

Updating state in a service

Arrange the lines of the method that adds a notification to a service based on a BehaviorSubject:

Items to put in order

  • }
  • this.notificationsSubject.next([...current, n]);
  • const current = this.currentNotifications;
  • addNotification(n: Notification): void {

You can check the correct answer by solving this task in the CodeWorlds game.