Interpolation:
Interpolation is a way angular use to display variables inside your HTML using the curly braces. You can display variables, named. Name <b>name<b> using {{name}}
You can bind the data from the class to the template
- Bind data using double curly bracket
{{property_name}} → there is class property name here. Then showing dynamic value.
2. Using expression
<h2>{{2+2}}</h2> → output: 4
3. Also concatenation + property name
concatenation: <p>{{“welcome ” + name}}</p>
<p>{{name.length}}</p>
<p>{{name.toUpperCase()}}</p>
4. Using method
<p>{{greetUser()}}</p>
5. Alternate way
public siteUrl = window.location.href;
<p>{{siteUrl}}</p>
Not possible:
<p>{{a = 2+2}}</p> (You can not assign the expression in a variable. So assignment is not possible in a variable)
<p>{{window.location.href}}</p> (so template is not aware javascript global variable)