我正在使用Ember-Data向找到here的Ember教程应用添加JSON API。应用程序的流程如下:
答案 0 :(得分:0)
只需使用实时记录数组
Takes a type and filter function, and returns a live RecordArray that
remains up to date as new records are loaded into the store or created
locally.
The callback function takes a materialized record, and returns true
if the record should be included in the filter and false if it should
not.
The filter function is called once on all records for the type when
it is created, and then once on each newly loaded or created record.
If any of a record's properties change, or if it changes state, the
filter function will be invoked again to determine whether it should
still be in the array.
IE
this.store.all('post')
this.store.filter('post', function(post){ return post.get('body').indexOf('ember')>=0;});
示例: