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 1

  1. The first component calls the service method.
  2. Service throws in Observable some value.
  3. 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