ember.js - defining redirecting route in ember causing other route to not work -


i have route defined as:

as.router.map(function(){     this.resource('analytics', {path: '/analytics'}, function(){         this.route('index', {path: '/'});         this.route('config', {path: '/config'});     );  });  as.analyticsroute = ember.route.extend({     redirect: function() {         this.transitionto('analytics.index');     } }); 

with above config, able load pages :

/#/analytics

--this loads analytics/index template

/#/analytics/config

--this loads analytics/config template

but #/analytics/index doesn't load, shows loading gif image. here how templates :

analytics:

{{outlet}} 

analytics\index:

index 

analytics\config:

config 

is there way make url link #/analytics/index work without breaking #/analytics?

thanks, dee

if define resource in router map analytics.index implicit route , should not defined explicit. default behaviour analytics.index template rendered analytics template's outlet in place have {{outlet}} defined.

so example should work expected:

as.router.map(function(){   this.resource('analytics', {path: '/analytics'}, function(){     this.route('config', {path: '/config'});   );  }); 

this render correctly analytics.index template analytics template outlet.

if analytics route should directly accessible when navigating "/" , want user redirected /analytics should redirect indexroute instead:

as.indexroute = ember.route.extend({   redirect: function() {     this.transitionto('analytics');   } }); 

hope helps.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -