Route#loading event

loading (transition, route) public

Defined in packages/ember-routing/lib/system/route.js:612
Available since 1.2.0

The loading action is fired on the route when a route's model hook returns a promise that is not already resolved. The current Transition object is the first parameter and the route that triggered the loading event is the second parameter.

App.ApplicationRoute = Ember.Route.extend({
  actions: {
    loading: function(transition, route) {
      let controller = this.controllerFor('foo');
      controller.set('currentlyLoading', true);

      transition.finally(function() {
        controller.set('currentlyLoading', false);
      });
    }
  }
});

Parameters:

transition Transition
route Ember.Route
The route that triggered the loading event
doc_EmberJs
2016-11-30 16:53:09
Comments
Leave a Comment

Please login to continue.