What are the different types of Subjects available in Angular?
- A subject is a special type of Observable which shares a single execution path among the observers which results in a multicast (one to many).
- There are four types of Subjects available based on how they behave:
- Subject - No initial value or replay available
- AsyncSubject - Emits latest values to subscribers on completion of the async task
- BehaviouralSubject - requires an initial value and emits current values to new subscribers
- ReplaySubject - replays a specified number of last values to new subscribers
Posted Feb 22, 2021