use of eventemitter in angular
@Output() open: EventEmitter<any> = new EventEmitter();
toggel() {
this.open.emit(null);
} @Component({
selector : 'child',
template : `
<button (click)="sendNotification()">Notify my parent!</button>
`
})
class Child {
@Output() notifyParent: EventEmitter<any> = new EventEmitter();
sendNotification() {
this.notifyParent.emit('Some value to send to the parent');
}
}
@Component({
selector : 'parent',
template : `
<child (notifyParent)="getNotification($event)"></child>
`
})
class Parent {
getNotification(evt) {
// Do something with the notification (evt) sent by the child!
}
}
Also in JavaScript:
- create array javascript fill
- javascript funtion
- react dom
- ejs-multiselect
- javascript in viewport
- sum array without loop javascript
- javascript validate is not a function problem
- Add New Properties to a JavaScript Object
- git remote url change
- javascript arrays codeburst
- purecomponent re rendering
- javascript get all select options
- js clone deep
- datatables add row
- javascript select row all delete
- javascript capitalize string
- how to use a js class in react
- pluton
- redux saga fetch json
- what is react native
- select jquery display none
- Difference in push and navigate in react Navigation
- ajax data not reflecting after refresh particular div jquery
- angular 9 release date