Template statements
What are Template Statements?
Template statements are used to interact with users through events in the HTML document. They allow the developer to call the components method in response to the users action. Also, it allows the developer to write simple logic in the template itself with multiple statements separated by colon (;). Let's learn more about the template statement in this chapter.
Syntax
Template statement is similar to JavaScript expression with the below exceptions.
Compound assignment operators: The template statement does not support compound assignment operators (+= and -=). Compared to the template expression, the statement supports the normal assignment operator (=).
The new keyword: Template does not allow the creation of new objects. All objects should be created in the component class. An object created in the component will be available in the template.
Increment and decrement operators: Template does not allow side effects. Since the increment and decrement operators do the side effects, they are excluded.
Bitwise operator: Bitwise operators (| and &) are not supported.
Pipe operator: Template statement does not support pipe (|) operator.