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?
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
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.