In angular docs there is a topic about listening for child events from parents. That's fine. But my purpose is something reverse!. In my app there is an 'admin.component' that holds the layout view of admin page (sidebar menu,task bar, status etc..).
In this parent component I configured router system for changing the main view between other pages of administrator.
The problem is for saving things after change, the user clicks on save button in task bar (that is placed in admin.component) and the child component must listen to that click event for doing save staff.
Javascript – Child listens for parent event in Angular 2
angulareventemitterjavascriptrxjstypescript
Related Topic
- Javascript – How to check for an empty/undefined/null string in JavaScript
- Javascript – Event binding on dynamically created elements
- Javascript – Setting “checked” for a checkbox with jQuery
- Javascript – How to test for an empty JavaScript object
- Css – CSS parent selector
- Javascript – For-each over an array in JavaScript
- R – How to Verify Atomic Writes
Best Answer
For the sake of posterity, just thought I'd mention the more conventional solution to this: Simply obtain a reference to the ViewChild then call one of its methods directly.