javascript / beginner
Snippet
Modern Communication with output()
The new output() API is the modern, more concise way to define component events without using the legacy EventEmitter class.
snippet.js
1
2
3
4
5
nameChange = output<string>();notify() {this.nameChange.emit('New Name');}
angular
Breakdown
1
output<string>();
Declares a new output with a specific data type.
2
this.nameChange.emit(...);
Sends the data to any parent component listening for this event.