I would like to bind an event emitter from a child to a parent component, but the parent component is the 'app.component'so i assume that the relationship between the two is not declared but implicit.
in this answer , i see how to add an event emitter to a child that has been explicitly declared as such, in his parent:
<child (notifyParent)="getNotification($event)"></child>
But in my app, the child component (lets call id: child), is not declared in that way, but its declared in the app.module
as route:
const appRoutes: Routes = [
{ path: '**', component: Child}
];
This component basically represents a splash page to the site, and is also used as a redirect in a guard in case full authentication is not provided.
What i would like to do, is to add an event emitter to child
that notifies app.module
of a change.
I have already implemented, in child
an EventEmitter
with the @Output()
decorator, and i have also implemented the method that will be invoked in app.module
but i just cant find a place where to register this binding within the two components.
Since all components are children of app.component
should not app.component
provide a way to register for incoming input from its children, without the need of declaring them explicitly as children first?