2013-01-11 26 views
6

任何人都可以向我解释为什么在调用ajax调用的成功方法之前,RecordArray状态为isLoaded的设置为true。Ember-data RecordArray isLoaded状态

从余烬数据源代码

findAll: function(store, type, since) { 
    var root = this.rootForType(type); 

    this.ajax(this.buildURL(root), "GET", { 
     data: this.sinceQuery(since), 
     success: function(json) { 
      debugger; 
     Ember.run(this, function(){ 
      this.didFindAll(store, type, json); 
     }); 
     } 
    }); 
    }, 

定义视图中的

handler: function() {   
    var content, controller = this.get('controller'); 
    if(controller.get('content.isLoaded')) { 
    } 
}.observes('controller.content.isLoaded') 

回答

0

对于任何人使用旧版本的Ember:我发现如果你用Ember.run.next包装你正在做的任何事情,那么内容实际上是,到那时。

不是最漂亮的解决方案,但它适用于我在Ember v1.0。