July 2017
Intermediate to advanced
454 pages
10h 1m
English
We can use expressions inside the template; expressions execute and result in a value.
Just like in JavaScript, we can use expression statements with the exception of using assignments, new and chaining operators.
Let's look at some examples of template expressions:
<p> {{ tax+10 }} </p> // Using plus operator<p> {{( tax*50)-10 }} </p>
In the preceding code snippet we are doing arithmetic operations with the variable tax.
If you have used any programming languages, chances are that you will find this section a cake-walk. Just like in any other language, we can make use of arithmetic operators.
Let's quickly create an example. Update the app.component.html file, and add the following code:
<h4>Template Expressions</h4> ...
Read now
Unlock full access