Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save d4rkc0de/522975300c4bbe45650084c11f7e6d4c to your computer and use it in GitHub Desktop.
Save d4rkc0de/522975300c4bbe45650084c11f7e6d4c to your computer and use it in GitHub Desktop.
Angular 2 : child componenet -> parent componenet
// child component :
export class ChildComponent implements OnInit {
@Output() close: EventEmitter<boolean> = new EventEmitter<boolean>();
callEvent() {
this.close.emit(true);
}
...
}
// method to ble called from the father after event trigerred :
export class ParentComponent {
isChildCrying(isIt: boolean) {
...
}
...
}
// html :
<parent-component>
<child-component (close)="isChildCrying($event)"></child-component>
</parent-component>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment