Issue
I have two components one in shared folder the other in components folder. In the components folder I have a component with a button which when is clicked will execute a function which is located in my services and is a globalFilterService. My problem is that I want that when this button will be clicked the function also executes for this other component which is located in the shared folder. More preciesly in this shared folder component I have a date-picker filter. In the other component I have some other filters, which when the button clicks these filters will return to default state. I want that as well this shared folder component date-picker filter return to the deafult state when the button on the other component is clicked.
Solution
For exchanging information between components without a direct relationship, I recommend reading about BehaviorSubject: BehaviorSubject
This allows us to subscribe to it and instantiate it with a value. In case we don't want to instantiate it with a value we can use a normal Subject.
Answered By - Joanmi
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.