Tuesday, November 9, 2021

Interpolation in Angular-10

 

Interpolation 

By using {{ }} we can use the property value only

String interpolation is One Way Data Binding

Which is used to output the data from typescript code

Simply, interpolation  is way of binding data from class to template




<p>Welcome to {{title}}</p>

<p>{{"Welcome to :" + title}}</p>

<p>{{title.length}}</p>

<p>{{title.toUpperCase()}}</p>

<p>{{userName()}}</p>

<p>{{myUrl}}</p>




component.ts file


public title = "Angular Bin";

public myUrl = window.location.href;


userName(){

   return "Welcome : " + this.title;

}



No comments:

Post a Comment