I have an Angular component that depends on a click event that occurs on the root App component. The child is located in random places inside the <app>
component, hence why I didn't list it.
@Component({
template: '<div>Child!</div>'
})
export class Child {
constructor () {}
}
@Component({
selector: 'app',
template: '<div (click)=foo()></div>'
})
export class App {
rootClickEmitter = new EventEmitter();
foo () {
this.rootClickEmitter.emit('bar');
}
}
How can I have the child component receive the rootClickEmitter
event?