What is data binding? Explain the four types.

Angular components and templates · Freshers

Model answer

Data binding connects the component class and the template. The types are:

Interpolation, {{ value }}, shows a value as text. Property binding, [property]="value", sets an element or component property. Event binding, (event)="handler()", runs a method when something happens, such as a click. Two-way binding, [(ngModel)]="value", keeps a field and a variable in sync in both directions.

Signal-based model() inputs also support two-way binding between a parent and a child component.

Tips

Learn this topic

Angular Tutorial: Beginner to Advanced .

Sign in to add your own answer.

More questions