我想知道最好的方法是将模型数据的加载延迟到动画完成之后。
在我的应用程序中,我正在监听路由的变化。然后,当匹配某个路线时,我打开一个带有动画的面板。但我希望在动画完成后开始加载数据。
以下是我收听路线的方式:
App.ApplicationController.reopen({
currentPathChanged:function() {
App.panelView.setNeedsOpen(this.get('currentPath') == 'index' ? false : true);
}.observes('currentPath')
});
这是面板必须打开时调用的路由之一:
App.NewsitemsRoute = Ember.Route.extend({
model: function() {
return App.Newsitem.find();
}
});
但正如您所见,当动画仍在运行时,数据会被预加载。我应该如何解决这个问题?