我有一个现有的Ember应用,效果很好。我需要添加一个新的子路由到应用程序,以允许用户查看其他信息。我目前的路线是这样的:向现有的Ember.js应用添加新路由,需要输入
Social.Router.map(function() {
this.resource('accounts', { path: '/accounts' }, function(){
this.resource('account', { path: ':account_id'});
});
});
使用下列URL
#/accounts/56/
我想补充的路线是这样的:
#/accounts/56/interactions
所以我增加了一个嵌套的路线一样所以:
Social.Router.map(function() {
this.resource('accounts', { path: '/accounts' }, function(){
this.resource('account', { path: ':account_id'}, function(){
this.route('interactions', { path: '/interactions'});
});
});
});
但是,当这条路被访问,我得到以下错误:
Uncaught Error: assertion failed: The route interactions was not found core.libs.js:2236
Uncaught Error: You cannot modify child views while in the inBuffer state core.libs.js:19298
所以我还添加了一个空InteractionsRoute但是这并没有解决这个问题:
Social.InteractionsRoute = Ember.Route.extend();
有没有人对输入什么可能会出错?
另外我想添加一个按钮来,看起来像这样的接口:
{{#linkTo "interactions"}}@ Interactions{{/linkTo}}
你没有在/之前的交互路线尝试它:{path:'interactions'}? – daniatic