First question so go easy on me!
I am looking to build a shared service in Angular2 that provides an observable property that can be subscribed to by components in the app.
Also I am looking to set this up so that the data is provided from a component and not via an HTTP get call. I have found examples of setups where it uses the DB as a datasource for CRUD actions, but not where it is an array or object created in the component.
A quick example is as follows:
- Service creates observable property at load
- Comp1 updates a property on service.
- Comp2 (subscribed to observable property on service) receives update from service.
- Comp2 continues to get changes as Comp1 continues to make changes to observable property
Does anyone know of a good explanation or have an example of this use case?
Thanks!