![]() |
VOOZH | about |
String interpolation is basically used to display the dynamic data on an HTML template. It facilitates you to make changes on component.ts file and automatically fetch data from there to the HTML template (component.html file).
So here we create a simple HTML template that uses the string interpolation, and then we write the function that is used inside the string interpolation.
Approach :
Syntax :
<h4>Book Price : {{ 'SHOULD BE LOWER CASE'.toLowerCase() }}</h4>
Example 1: (In-Build Functions) Add the below HTML inside angular template and run using "ng serve" and it makes the string lower-case.
Output :
👁 ImageIn the above code, we have created a books array which store the book object and then we have created three functions and we are going to use these three function inside string interpolation to print specific book detail.
Output:
👁 ImageHere in the HTML template, we are using a function inside string interpolation to print specific book data.