Skip to content

Instantly share code, notes, and snippets.

@nclarx
Last active January 10, 2019 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nclarx/a88f143b44bc23fa629d195abc1f169a to your computer and use it in GitHub Desktop.
Save nclarx/a88f143b44bc23fa629d195abc1f169a to your computer and use it in GitHub Desktop.
Event Emitter
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