There are two adjacent components and service. By pressing the button of the first component, the second component should load itself the data from the service. How to organize it?
1 answer
- The first component calls the service method.
- Service throws in Observable some value.
- The second component subscribed to this Observable does something.
You can use EventEmmiter instead of Observable.
- and if the service is only internal? :-) - Grundy
- @Grundy, I do not know what internal service is. - Qwertiy ♦
- an instance of which is created inside the component only :) - Grundy
- @Grundy, then you need to change this architecture))) - Qwertiy ♦
|