Answer the question
In order to leave comments, you need to log in
Why does the EventEmitter fire?
Please help me understand the essence of the EventEmitter. Here is a classic example of his work. Here you can clearly see that in the color-picker component, on click, an event is emitted: this.selectedColorChange.emit(color);
Next, in the template of the app component, this event is received:
<app-color-picker
[colors]="['#f00', '#ff0', '#a00']"
(selectedColorChange)="change($event)"
[(selectedColor)]="color">
</app-color-picker>
change(color) {
alert('change' + color);
}
(selectedColorChange)="change($event)"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question