Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
Say hello to Angular's future home!Check out Angular.devHome
/

Understanding templates

In Angular, a template is a blueprint for a fragment of a user interface (UI). Templates are written in HTML, and special syntax can be used within a template to build on many of Angular's features.

Prerequisites

Before learning template syntax, you should be familiar with the following:

Enhancing HTML

Angular extends the HTML syntax in your templates with additional functionality.
For example, Angular’s data binding syntax helps to set Document Object Model (DOM) properties dynamically.

Almost all HTML syntax is valid template syntax. However, because an Angular template is only a fragment of the UI, it does not include elements such as <html>, <body>, or <base>.

To eliminate the risk of script injection attacks, Angular does not support the <script> element in templates. Angular ignores the <script> tag and outputs a warning to the browser console. For more information, see the Security page.

More on template syntax

You might also be interested in the following:

Last reviewed on Wed May 11 2022