O'Reilly logo

Mastering Ember.js by Mitchel Kelonye

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Specifying a view's element tag

A view's template is usually wrapped in a div element by default, as shown in the following example:

<div>{{name}}</div>
<div>{{gender}}</div>

This yields the following:

<div id='ember10' class='ember-view'>
  <div>Jon Doe</div>
  <div>Male</div>
</div>

This element type can be altered using the tagName property of the view class, as shown in the following code:

var View = Ember.View.extend({
  templateName: 'user',
  tagName: 'header'
});

The preceding snippet will yield something like the following:

<header div id='ember10' class='ember-view'>
  <div>Jon Doe</div>
  <div>Male</div>
</header>

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required