5
我試圖重定向/儀表板/到/儀表板/到達/人口如果URL命中/儀表板/。Emberjs只重定向到默認路由如果沒有指定subroute是
問題是,我仍然被重定向到/dashboard/reach/demographic/,如果我點擊**/dashboard/traffic等子路由。
什麼是Ember的做法?
這裏是我的代碼:
(function() {
App.Router.map(function(match) {
this.resource('dashboard', function() {
this.resource('traffic', function() {
this.route('visits');
this.route('pageviews');
return this.route('duration');
});
return this.resource('reach', function() {
this.route('demographics');
this.route('over_time');
return this.route('devices');
});
});
return this.route('audience');
});
App.DashboardRoute = Ember.Route.extend({
redirect: function() {
return this.transitionTo('reach.demographics');
}
});
if (!App.ie()) {
App.Router.reopen({
location: 'history'
});
}
App.reopen({
rootUrl: '/'
});
}).call(this);