在路线更改后显示模板时遇到问题。日志指出我已转换为 form.newrecord 但模板未呈现。
路由器:
App.Router.map(function(){
this.resource('home', { path: '/' });
this.resource('form', { path: '/forms/:form_id' }, function() {
this.route('newrecord', { path: '/newrecord' });
});
});
App.FormNewRecordRoute = Ember.Route.extend({
renderTemplate: function() {
this.render("form/newrecord", {
into: "application",
outlet: "newrecord"
})}
});
模板:
<script type="text/x-handlebars" data-template-name="application">
{{outlet}}
{{outlet newrecord}}
</script>
<script type="text/x-handlebars" data-template-name="home">
<h1>Test</h1>
</script>
<script type="text/x-handlebars" data-template-name="form">
<h1>Test 2</h1>
</script>
<script type="text/x-handlebars" data-template-name="form/newrecord">
<h1>This is a test</h1>
</script>