BehaviorSubject in Angular

How and where to use rxjs BehaviorSubject is our application?

BehaviorSubject is a part of RXJS library not specific to Angular part we can use this library with React, Vue etc. The question is why we need to use RXJS in Angular for example we want to pass data in any component in our app tree we can not use input and output decorator because input and output decorator only works in parent child relation but this is not the case here we want to push data in anywhere in our application the solutions BehaviorSubject with BehaviorSubject we can pass data to any component in our application tree. In the demo when you enter a value and submit then you will the entered value in second component we are passing the data from one component to another component with the help of BehaviorSubject. BehaviourSubject will return the initial value or the current value on Subscription.

Demo Githhub Stackblitz

47 thoughts on “BehaviorSubject in Angular

  1. KAYSWELL

    I used to be recommended this web site through my cousin. I’m not positive whether this submit is written via him as nobody else understand such unique about my problem. You are amazing! Thanks!

  2. Hairstyles

    Its like you read my thoughts! You seem to know a lot about this, like you wrote the book in it or something. I feel that you simply can do with some p.c. to power the message home a bit, however other than that, this is great blog. An excellent read. I will definitely be back.

  3. Delores

    I would like to thank you for the efforts you’ve put in writing this site.
    I really hope to view the same high-grade blog posts from you in the future as well.
    In fact, your creative writing abilities has inspired me to get my own website now 😉

  4. Hairstyles Women

    Hi! I know this is somewhat off topic but I was wondering if you knew where I could locate a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having problems finding one? Thanks a lot!

Leave a Reply

Your email address will not be published. Required fields are marked *