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$;
}
}
↧
Ionic 4 Service variables do not change their values
↧