Hey everyone,
I started to create my first Ember app a and I have a problem with Ember.Route.reopen. I want to extend the beforeModel function to all my routs for some kind of session handling. My plan was like this:
Ember.Route.reopen({
beforeModel: function(transition){
hasSession ? routTo X : routeTo login
// will not be called if direct access
},
afterModel: function(transition){
hasSession ? routTo X : routeTo login
// will always be called
},
}
This works perfect when I click around the App, however, when I directly access the path in the browser, he does not call the extended beforeModel if the Route has a dedicated beforeModel.
App.PlaygroundRoute = Ember.Route.extend({
beforeModel: function(transition) {
// will be called
},
afterModel: function(){
// will be called
}
});
What I do not understand, it works when I put it in the afterModel. Then he doesn’t care if a dedicated afterModel function is set in the Route.
Did I miss something here?
(Sorry for my bad English, it’s not my mother tongue)
*Edit for layout