我怀疑你在每条路线上都需要它,更有可能你只是需要它作为验证资源的大门。
App.Router.map(function(){
this.route('login'); // doesn't need it
this.resource('a', function(){ <-- need it here
this.resource('edit'); <-- this is protected by the parent route
});
this.resource('b', function(){ <-- and here
this.resource('edit'); <-- this is protected by the parent route
});
});
,或者你可以把它更深层次的原因只是创建一个包装的一切路线:
App.Router.map(function(){
this.route('login'); // doesn't need it
this.resource('authenticated', function(){ <-- put it here
this.resource('a', function(){ <-- this is protected by the parent route
this.resource('edit'); <-- this is protected by the grandparent route
});
this.resource('b', function(){ <-- this is protected by the parent route
this.resource('edit'); <-- this is protected by the grandparent route
});
});
});
是啊。这正是我正在寻找的。我可能会补充说我在验证过的资源上定义了一个空路径'{path:''}',这样我的url看起来和以前一样。谢谢! – niftygrifty 2014-09-09 06:05:28