In this article, we are going to see Subject and Behavior Subject in RxJs library.

What is a Subject?

Subject is a special type of Observable in RxJs Library in which we can send our data to other components or services. A Subject is like an Observable but can multicast to many observers which means subject is at the same time an Observable and an Observer.

Here are some important points of subjects

  • A Subject is a Special type of Observable that allows value to be multicasted to many Observers.
  • Subject are like event emitters.
  • No Initial Value
subject =new Subject<datatype>();  

#angular #angular 8

Subject and Behavior Subject in Angular 8
15.50 GEEK