Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4830

Child route logic being called before parent route logic. Is this right?

$
0
0

@Andrew_Max wrote:

I have a route nested inside of a parent which inherits from a mixin.

// mixins/authenticated-base-route
    import Ember from 'ember';
    import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';

    export default Ember.Route.extend(AuthenticatedRouteMixin, {
      activate: function (){
         console.log('b')
         doSomeStuff();
      }
    });

/pods/admin/route.js
import AuthenticatedBaseRoute from 'web-ui/routes/authenticated-base-route';

export default AuthenticatedBaseRoute.extend({
  activate: function () {
    console.log('a')
    this._super();
    console.log('c')
  },
});

//pods/admin/flights/route.js
import Ember from 'ember';

export default Ember.Route.extend({
  afterModel: function () {
    console.log('d')
  },
});

My impressions was that route logic executes sequentially from the index route down.

My expectation would be then that my logs would git in the order of : a b c d

In reality though, when I hit the route "/admin/flights" directly through the url bar, the "afterModel" in "/admin/flights" executes before "activate" "admin" causing the log order to be:

"d a b c"

Is this a bug or is this expected behavior. If so can anyone point me to an explanation which would help me wrap my head around determining the execution order?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4830

Trending Articles