RxJS Subjects are a special type of Observable that can multicast to multiple Observers simultaneously. Unlike plain Observables, a Subject is also an Observer, meaning you can call next(), error(), and complete() directly on it. RxJS provides four Subject variants: Subject (no initial value, only future emissions), BehaviorSubject (requires initial value, new subscribers get the last emitted value), ReplaySubject (replays all past emissions to new subscribers), and AsyncSubject (only emits the last value upon completion). Each variant suits different use cases, and a best practice is to expose subjects via asObservable() to prevent consumers from calling next() or complete().
Sort: