Reputation: 115
I got a "Settings"-Controller for my route "/settings".
But this specific route does not exist. There are only following routes:
Now, i want to redirect all "/settings" requests to "/settings/account". This works fine, ... but just once.
If i click on a button with the target "/settings" i get redirected to "/settings/account". But if i click a second time on that same button, there is no redirect and it gets me on "/settings".
Here is my code:
export default Ember.Route.extend({
redirect() {
this.transitionTo('settings.account');
}
});
Why does this works just once?
Upvotes: 0
Views: 115
Reputation: 1153
Redirect is kinda special. You can read more about how exactly it works here. It looks like you don't want to fire model hooks here at all so you should redirect it like this.
import Ember from 'ember';
export default Ember.Route.extend({
beforeModel() {
this.transitionTo('settings.account');
},
});
Upvotes: 1