Search code examples
angularparent-child

Pass a object of values from client to parent in angular when loaded


I need to pass a group of values to the parent when a child component is loaded. Not sure what I am doing wrong. Any help would be greatly appreciated.

This is the "data class"

enter image description here

parent.component.ts contains this function:

enter image description here

and child.component.ts looks like this:

enter image description here

*** UPDATE *** I should probably mention that the child pages are being loaded by a router action from the menu for a Single Page Application:

enter image description here


Solution

  • Because the child components are being loaded dynamically using a routerlink, the "router-output" tag does support emit since the page has not yet loaded. The solution was to create a mediator service follow the instructions I found at the link below.

    Thank you everyone for you help.   https://chinedujude.medium.com/angular-emit-event-through-router-outlet-53b55fbd1f28