【发布时间】:2017-10-12 14:16:37
【问题描述】:
假设我的路线中有以下代码:
model() {
return this.get('store').query('post', { author: 'John' });
},
actions: {
fetchNewPosts: function() {
this.get('store').query('post', { author: 'Sally' });
}
}
然后在一个组件中如下:
modelSubset: function() {
return this.get('model').slice(0, 10);
}.property('model', 'model.@each'),
当输入路由时,组件中的计算属性会更新良好,并且作者“John”的帖子会在模型挂钩中获取。
但是,如果我稍后触发 fetchNewPosts 操作,则会获取记录并将其添加到 Ember 数据中,但组件中的计算属性不会更新。
有没有办法获取新记录以更新模型属性?
【问题讨论】:
标签: javascript ember.js