RPeraltaJr
7/14/2017 - 6:34 PM

Event Binding

Event Binding

<!-- When user clicks the button, call the 'saveUser' function on the
component instance and pass the underlying event -->
<button (click)="saveUser($event)"></button>

<!-- You can also create events for custom components. Here we have a 
depleted event, and it's going to call the 'soundAlarm function
on the component instance when it fires" -->
<coffe-maker (depleted)="soundAlarm('loud')"></coffe-maker>

<!-- There are also shortcut event bindings! The submit function on the
component instance will be called when there user presses control and enter -->
<textarea (keydown.control.enter)="submit()"></textarea>