Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
Angular

BehaviorSubject in RxJS

Hold current state and emit the latest value to new subscribers.

BehaviorSubject in RxJS — a practical guide to RxJS BehaviorSubject with clear examples you can reuse in real projects.

Angular Tutorial Series (60/119). Prefer one article? Read the complete Angular tutorial.

Short description

Great for auth user and simple store-like services.

BehaviorSubject

private readonly user$ = new BehaviorSubject<User | null>(null);
readonly user = this.user$.asObservable();
setUser(u: User) { this.user$.next(u); }

Leave a reply

Your email address will not be published. Required fields are marked *