What is the primary difference between behaviorSubject and observable in Angular?
meda Changed status to publish 18/07/2022
- Angular BehaviorSubject is a subject that emits the last value emitted by the source Observable.
- Angular Observable is used to emit values over time.
BehaviorSubject is Angular observable with defined features; it is theoretically a sub-type of Observable; Observable is generic. A subject can be used to construct an observable with the help of BehaviorSubject.
The primary difference is that you can’t use the next() method to deliver data to an observable.
Let’s discuss the basic concepts of Angular Observable and BehaviorSubject.
meda Changed status to publish 12/07/2022