Recall & Review
beginner
What is an Angular Subject?
A Subject is a special type of Observable that allows values to be multicasted to many Observers. It acts like a bridge to send data to multiple subscribers.
Click to reveal answer
intermediate
How does a BehaviorSubject differ from a regular Subject?
BehaviorSubject stores the latest value emitted and immediately sends it to new subscribers. It requires an initial value when created.
Click to reveal answer
intermediate
What is the main feature of a ReplaySubject?
ReplaySubject records a specified number of previous values and replays them to new subscribers, even if they subscribe late.
Click to reveal answer
beginner
Which Subject type would you use to always get the latest value upon subscription?
Use BehaviorSubject because it holds the current value and sends it immediately to new subscribers.
Click to reveal answer
beginner
Can a regular Subject replay old values to new subscribers?
No, a regular Subject does not store or replay old values. New subscribers only receive future emissions.
Click to reveal answer
Which Subject type requires an initial value when created?
✗ Incorrect
BehaviorSubject needs an initial value to store and emit immediately to new subscribers.
What does a ReplaySubject do when a new subscriber joins?
✗ Incorrect
ReplaySubject replays a specified number of past values to new subscribers.
Which Subject type does NOT store any previous values?
✗ Incorrect
A regular Subject does not store or replay any previous values.
If you want subscribers to always get the last emitted value immediately, which Subject should you use?
✗ Incorrect
BehaviorSubject holds the latest value and sends it immediately to new subscribers.
Which Subject type can replay multiple past values to late subscribers?
✗ Incorrect
ReplaySubject can replay multiple past values to subscribers who join late.
Explain the differences between Subject, BehaviorSubject, and ReplaySubject in Angular.
Think about how each Subject handles new subscribers and stored values.
You got /4 concepts.
Describe a scenario where using a BehaviorSubject is better than a regular Subject.
Consider when you want new subscribers to get the current state right away.
You got /4 concepts.