我想获取 URL:localhost#/234/23/456/524jk53 (/one_id/two_id/three_id/four_id)
Stat.Router.map(function () {
this.resource('one', {path: '/:one_id'}, function(){
this.resource('two', {path: '/:two_id'}, function(){
this.resource('three', {path: '/:three_id'}, function () {
this.resource('four', {path: '/:four_id'});
});
});
});
});
和模板分离:
<script type="text/x-handlebars">
{{outlet one}}<br>
{{outlet two}}<br>
{{outlet three}}<br>
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="one">
one, to {{linkTo 'two'}}two{{/linkTo}}
</script>
<script type="text/x-handlebars" data-template-name="two">
two, to {{linkTo 'three'}}three{{/linkTo}}
</script>
<script type="text/x-handlebars" data-template-name="three">
three, to {{linkTo 'four'}}four{{/linkTo}}
</script>
<script type="text/x-handlebars" data-template-name="four">
four
</script>
路线:
App.oneRoute = Em.Route.extend({
renderTemplate: function() {
this.render('two', {outlet: 'two'});
this.render('three', {outlet: 'three'});
this.render('four', {outlet: 'four'});
}
});
我有错误:断言失败:无法在未定义的对象上调用带有 'id' 的 get。
请帮我为这个应用程序的层次结构编写 router.map