YUNOVA · Angular · Module 10: Advanced RxJS and state
Subject and BehaviorSubject
Subject and BehaviorSubject
Key points
- A Subject is both an Observable and an Observer that multicasts values.
- A BehaviorSubject needs a starting value and replays the latest to new subscribers.
- Services often expose a BehaviorSubject as asObservable() to share state.