Angular · Junior · Question 11 of 75
How do you handle a button click?
- ✓Correct answer:
<button (click)="save()"> - 2
<button onClick={save}> - 3
<button [click]="save()">
Explanation
Parentheses are event binding. The $event variable gives access to the DOM event: (input)="onInput($event)". Square brackets are for property binding, not events.