Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 230059

Ionic 4 Service variables do not change their values

$
0
0
interface Profile {
  id: string;
  email: string;
  ...
}

class ProfileService {
  activeUser$ = new BehaviorSubject<Profile | undefined>();

  updateActiveUser(profile: Profile): void {
    this.activeUser$.next(profile);
  }
  
  peekActiveUser(): Profile | undefined {
    return this.activeUser$.value;
  }

  watchActiveUser(): Observable<Profile | undefined> {
    return this.activeUser$;
  }
}

Viewing all articles
Browse latest Browse all 230059

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>