Created
February 27, 2017 14:33
-
-
Save d4rkc0de/522975300c4bbe45650084c11f7e6d4c to your computer and use it in GitHub Desktop.
Angular 2 : child componenet -> parent componenet
This file contains hidden or 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
// 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