If we would like to tell the parent Component that the child component has added or deleted subtask. How to implement in Angualr2 ?
To create a custom event, we can use the new @Output decorator. So let's start by creating a new instance of an Event Emitter and decorate the property with the @Output decorator.
Then we've got an event emitter in place, let's call its emit method, callParent(), to raise the event and pass to parent component.
The child component's code snippet looks like:
The parent component receives that event and its payload. We use event binding to bind to this notify event and call a method.
Our final step is to provide the refreshIssue method to execute when the notify event occurs.
We have to pass the $event to parent component's handler because that variable holds the event payload.