Introduction to Templates
Learn about templates in Ember and how they render UI to a web browser.
Templates are HTML
In Ember, a template is just HTML with the ability to render dynamic content. Templates are written in the Handlebars language. Ember uses Glimmer as a template engine, which makes it compatible with Handlebars syntax.
Handlebars
Handlebars is a templating language. In the compilation stage, Handlebars converts templates into JavaScript functions and makes executions faster. Dynamic expressions are passed in double curly braces: {{...}}
. These double curly braces are also known as mustaches in Handlebars. During the execution of a template, the expressions between curly braces are replaced by the values coming from an object. The example below contains two Handlebars expressions, firstname
and lastname
.
<h4> {{firstname}} {{lastname}} </h4>
Get hands-on with 1200+ tech skills courses.