0
我正在研究一个简单的Ember CRUD应用程序,并遇到了交换具有“编辑”模板的“显示”模板的问题。这里是我的路线配置:如何替换Ember中的当前把手模板
App.Router.map(function(){ //map URLs to templates
this.resource('contacts',{path: '/contacts'}, function(){
this.resource('contact', {path: '/contact/:contact_id'}, function(){
this.route('edit');
this.route('create');
this.route('delete');
});
});
});
以下模板显示我的模型。我想链接到更换与编辑模板显示模板:
<script type="text/x-handlebars" data-template-name="contact">
<h3>{{ firstName }} {{ lastName }}</h3>
<h4>Contact Details</h4>
{{ email }}
<br/>
{{ phone }}
<br/>
{{#link-to "contact.edit" this}}edit{{/link-to}}
</script>
不幸的是,当用户点击该#link-to "contacdt.edit"
,认为在{{口}}(我只加了{{出口呈现}}进行调试)。编辑模板似乎也没有正确绑定到当前模型。
请参阅此jsfiddle的完整示例。