javascript / beginner
Snippet
Component Communication with EventEmitter
An EventEmitter allows a child component to send data back to its parent. It is always paired with the @Output decorator to define an custom event.
snippet.js
javascript
1
@Output() statusUpdate = new EventEmitter<string>();
angular
Breakdown
1
@Output()
A decorator that marks the property as a way for data to flow out of the component.
2
new EventEmitter<string>()
Initializes a new emitter that will send string-type data.