Search code examples
node.jsangulartypescriptecmascript-6angular8

Communicating between child to parent component in Angular 8


I am trying to communicate to my parent controller that a new item have been added in its child component. I am aware that for this I have to use @Output and event emitters, and I am using them, but it doesn't seem to be working. Is there another way to accomplish this?


Solution

  • Yes, there is. You can create a "service" and have a multi-cast observable / subject (e.g. BehavioralSubject<>) push new values.

    Here's a good starting point (btw, check out the other methods, too):

    Parent and children communicate via a service