Search code examples
angularcomponentsangular2-routing

How do I update a list in a component, if I press a link in another component?


I have one component which contains several links to different categories. If I press one of those links, a list of articles that belong to that category must be loaded in another component.

I have read about the tag called router-outlet, but as far as my understanding goes, this tag can only be used if I want to update something in the same component.

How can I solve my problem?


Solution

  • I have answered a similar question to this before. Please see my response here. A synopsis is to use a shared service to store the information and watch for changes using observables and subscribe to the observable in your component that needs to watch for the changes.