Ember transition & rendering complete event

后端 未结 4 1352
执念已碎
执念已碎 2020-11-29 08:32

Is there any event fired stating the transition/rendering has completed (and the dom is visible/ready).

setupcontroller/activate are before the dom is built/rendered

4条回答
  •  执念已碎
    2020-11-29 09:12

    The afterModel hook might work for you:

    App.MyRoute = Ember.Route.extend({
      afterModel: function(model, transition) {
        transition.then(function() {
          // Done transitioning
        });
      }
    });
    

    I tested this using RC-7 with routes that both do and don't have dynamic segments (i.e., a route with a model and a route without a model). It seems to work either way.

    See this JSBin for an RC-6 example:
      Output: http://jsbin.com/OteC/1/
      Source: http://jsbin.com/OteC/1/edit?html,js

提交回复
热议问题