0
我想獲得網址:本地主機#/ 234 /456分之23/ 524jk53(/ one_id/two_id/three_id/four_id)Ember.js幫助路由器地圖
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' 得到一個未定義的對象上。
請幫我寫router.map這種應用的層次
你想從服務器獲取這個URL?或者你想讓這個URL成爲應用程序中的一個路由? – shashin