javascript - "TransitionTo" affects page refresh in Ember -
my ember application contains parent route 2 nested routes. after fetching parent route's model i'll transition 1 of nested routes default.
the router follows
this.resource('parent', {path: '/parent'}, function() { this.route('route1', {path: '/route1'}); this.route('route2', {path: '/route2'}); });
in parent route
redirect: function() { this.transitionto('parent.route1'); }
now works fine. problem arises when refresh page while being on route "#/parent/route2".
actually should contents of "route2" transitionto makes route render "route1". how can handle ?
in addition this. i'm fetching parent route's model in nested routes using "this.modelfor('parent')".
instead of having redirect in app.parent
, have in app.parentindex
.
app.parentindexroute = ember.route.extend({ redirect: function() { return this.transitionto('parent.route1'); } });
demo http://emberjs.jsbin.com/pavomo/2/#/sales/orders/
note redirected orders/4 default if no subroute found.
Comments
Post a Comment