Angular Data Binding


Angular Data Binding

Data binding keeps your page up to date, depending on the condition of your application. You can use data binding to describe things like an image's source, a button's state, or data for a specific user.

Data Binding Types

According to the direction of data flow, Angular offers three types of data binding:

  • From source to view.
  • From the view to source.
  • View to the source to view in a two-way series.

A target name appears to the left of the equal sign in binding kinds other than interpolation. A property or event is the destination of a binding, which you can enclose with square brackets, [], parentheses, (), or both, [()].

The direction of data flow is specified by the binding punctuation [], (), [()], and the prefix.

  • Bind from source to view with [].
  • To link a view to a source, use ().
  • To bind in a two-way sequence of view to the source to view, use [()].

Types of bindings and their aims

A property, an event, or an attribute name can target a data binding. A source directive's public members are automatically available for binding in a template expression or statement.