Thuta Learning
BasicWeb Developmentintermediate

Event Binding ( )

Relax. We'll talk through this in plain words — no textbook voice.

Event Binding ( ) lets you connect user actions (e.g., click, input) to a method in the component. Data flows one-way, from the template to the component.

typescript
<button (click)="onSave()">Save</button>
<p>{{ message }}</p>

// component.ts
export class MyComponent {
  message = '';
  onSave() {
    this.message = 'Data has been saved!';
  }
}
You should see
(Clicking the button will display the text 'Data has been saved!')
Event Binding ( ) | Thuta Learning