Answers for "angular event emitter"

8

angular event emitter

@Output() open: EventEmitter<any> = new EventEmitter();


  toggel() {
  	this.open.emit(null);
  }
Posted by: Guest on March-26-2020
1

use of eventemitter in angular

@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!
    }
}
Posted by: Guest on October-07-2020
3

emitter angular

<component
  (open)="open($event)"
></component>
Posted by: Guest on May-23-2020
0

what does event emitter do in angular

Data flows into your component via property bindings and flows out of your component through event bindings. If you want your component to notify his parent about something you can use the Output decorator with EventEmitter to create a custom event.
Posted by: Guest on August-08-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language