0 day streak
javascript / beginner
Snippet

Handling Events with (click)

Event binding uses parentheses to listen for browser events and trigger methods defined in your component class.

snippet.js
javascript
1
<button (click)="onSave()">Save Data</button>
angular
Breakdown
1
(click)="onSave()"
Binds the standard DOM click event to the 'onSave' method in the TypeScript file.