我有一个content
绑定到对象的控制器,该对象从不同来源异步加载数据。我希望在加载完成后呈现数据。这工作得很好,但是当我想更改数据时,#each 块不会重新呈现它。
App.PopularTracks = Ember.Object.create({
tracks: [],
load: function() {
var self = this;
var tracks = [];
LFM.get("chart.getHypedTracks", {limit: 5}, function(data) {
// push each track to tracks in a loop, then
self.set("tracks", tracks);
});
// This method has also other asynchronous calls that work similar,
// but #each block doesn't rerender on `tracks` change.
}
});
App.PopularTracksController = Ember.ArrayController.extend({
contentBinding: "App.PopularTracks.tracks"
});
App.PopularTracksView = Ember.View.extend({
templateName: "popularTracks"
});