Gjaldon
Gjaldon

Reputation: 5644

Ember can't find template when I provide a custom templateName to a View in Ember-CLI

When I pass a templateName option to a View, Ember couldn't find the template with the corresponding name. I have created a template with the name nav-tabs.hbs and passed 'nav-tabs' to the templateName property of an Ember.View object.

All I get is an error about not being able to find a template with that name. When I check Ember.TEMPLATES, it is empty. What am I doing wrong?

Upvotes: 1

Views: 333

Answers (1)

Pete C
Pete C

Reputation: 215

In the Ember-CLI world, you want to use the ES6 import syntax, and supply your template to the View's template property:

// app/views/my-view.js
import Ember from 'ember';
import Template from 'app/templates/my-template';

export default Ember.View.extend({
  template: Template
});

Upvotes: 3

Related Questions