Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • Looks good, but how do I unsubscribe after I leave this component and want same functionality on the other? With this setup callbacks are adding to each other. Commented Nov 8, 2018 at 11:00
  • Already solved it. Removed from app.module providers and added into component providers. Also added ngOnDestroy() { ...unsubscribe(); } into service. Service singleton was the problem. Is there any problem with solution like this? Commented Nov 8, 2018 at 11:07
  • That is absolutely fine.👍 Commented Nov 8, 2018 at 11:12