我懷疑你在每條路線上都需要它,更有可能你只是需要它作爲驗證資源的大門。
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