Answer the question
In order to leave comments, you need to log in
How to implement two-way bindings between a component and a service?
There is a service in which an object is created based on data in LocalStorage, for example. I call getData in the component, I get the data, after changing the data in localStorage, without refreshing the page, the data does not change. how to implement it? I am using angular 6. (I know that in angular 1.6 this is possible, but implemented in the same way, it does not work)
Answer the question
In order to leave comments, you need to log in
Use NgRx or a common data bus based on RxJS Behavior Subject.
In a component, you subscribe to state changes.
You can also use the event onstorage
to update components in other tabs.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question