Lesson 6 / 30

Event Binding

React to clicks, input, and other DOM events.

(event)="handler()"

Parentheses bind a DOM event to a method on the component class.

<button (click)="increment()">+1</button>
<p>Count: {{ count }}</p>

The $event object

$event gives access to the native event, such as the keyboard key or input value.

<input (keyup.enter)="search($event)">