Slowly getting to grips with angular 2 but I've come to dead end on one particular issue.
If you have this arrangement;
<parent>
<child/>
</parent>
I can notify the child of changes in the parent by using @Input() and get it to listen to changes. I can notify the parent of changes in the child by using the @Output() and EventEmitters.
What I'm now looking at is notifying a routed component (a component that is loaded dynamically when a link it clicked) about a specific event that happens in the main appComponent. See example below;
<app>
<button (click)='addEntity()>Add</button>
<router-outlet></router-outlet>
</app>
I want to be able to notify the component that is loaded into the router-outlet that the button has been clicked.
An example of usage would be having multiple features (heroes/contacts/pets etc) each with its own dialog for adding an entity. Depending on the selected route, it would need to notify the selected feature component (e.g. ContactComponent) to display its specific detail component/view/template (e.g. contact-detail.component).
Whats the best way to achieve this?
Cheers