Data binding

In Angular, we use data binding to coordinate the application's state with the content rendered on screen. Angular supports three kinds of binding, distinguished by the direction of data flow:

Data direction

Syntax

Type

One-way from data source to view target

{{expression}} [target]="expression"

  • Interpolation
  • Property
  • Attribute
  • Class
  • Style

One-way from view target to data source

(target)="statement"

Event

Two-way

[(target)]="expression"

Two-way

Binding types other than interpolation have a target name to the left of the equals sign, surrounded by punctuation ([] and ()).

Please refer to the documentation at https://angular.io/guide/template-syntax to learn more about the data binding syntax. ...

Get Learning TypeScript 2.x - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.