Interpolation In Angular

Interpolation In Angular – By Sagar Jaybhay

It is called as data binding and in angular, we have 3 categories of data binding.

  • One Way data binding: it is from component to view template
  • One way data binding: it is from view template to component
  • Two-way data binding: it is from component to view and vice versa.

One Way Data Binding:

In interpolation you can use mathematical operation, validation, condition checking. By using interpolation you can bind class properties to element properties. Interpolation is all about moving class data to html template in one direction means component class properties to html element properties.

<img style="height: 200px; width: 200px" src="{{ imagePath }}" /> 
Interpolation in angular

Property Binding:

Property Binding and Interpolation flow data from one direction.

<img style="height: 200px; width: 200px" [src]="imagePath" />
Interpolation binding in angular sagar jaybhay

Interpolation v/s Property binding

  • Interpolation is special syntax that angular converts into a property binding.
  • In concatenation of string we can use interpolation instead of property binding
  • To set an element property to a non-string data value, you must use property binding
  • You can use canonical variation means for binding to property of html element rather than using [] braces use bind-property-name.
<span bind-innerHtml="_first"></span>
  • For security reason angular data-binding automatically sanitizes malicious content before displaying it on browser.
component binding

DOM: Angular all about binding to dom object properties and not html attribute

Audio Url – https://audiomack.com/song/sagar-170/interpolation-in-angular-by-sagar-jaybhay

Sagar Jaybhay, from Maharashtra, India, is currently a Senior Software Developer at Software Company. He has continuously grown in the roles that he has held in the more than seven years he has been with this company. Sagar Jaybhay is an excellent team member and prides himself on his work contributions to his team and company as a whole.

Sagar Jaybhay

Sagar Jaybhay, from Maharashtra, India, is currently a Senior Software Developer at Software Company. He has continuously grown in the roles that he has held in the more than seven years he has been with this company. Sagar Jaybhay is an excellent team member and prides himself on his work contributions to his team and company as a whole.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *