Last active
January 10, 2019 09:36
-
-
Save nclarx/a88f143b44bc23fa629d195abc1f169a to your computer and use it in GitHub Desktop.
Event Emitter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ParentComponent { | |
handleEventFromChild($event: Event): never { | |
// Do something with event... | |
} | |
} | |
// HTML TEMPLATE IN PARENT | |
<app-child-component (emitEvent)="handleEventFromChild($event)"></app-child-component> | |
// ============================================ | |
public class ChildComponent { | |
@Output() eventEmitter: EventEmitter<boolean> = new EventEmitter(); | |
emitEvent(): void { | |
this.eventEmitter.next(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment