Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ember.js/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ember.js Emberjs-如何正确修改已在控制器中设置为属性的模型上的记录?_Ember.js_Ember Cli - Fatal编程技术网

Ember.js Emberjs-如何正确修改已在控制器中设置为属性的模型上的记录?

Ember.js Emberjs-如何正确修改已在控制器中设置为属性的模型上的记录?,ember.js,ember-cli,Ember.js,Ember Cli,我的模板: {{#each test11}} {{businessname}} {{/each}} 我的工作控制器: // businessmatches is a model that is set as a controller property in the router test11: function () { var raw = this.get('businessmatches'); // I want to be able to

我的模板:

    {{#each test11}}
        {{businessname}}
    {{/each}}
我的工作控制器:

// businessmatches is a model that is set as a controller property in the router
test11: function () {
    var raw = this.get('businessmatches');

    // I want to be able to get all the records, filter them etc etc and then
    // make them available to the template

    return [
        Ember.Object.create(raw.content.get(0)._data)
    ];
}.property('businessmatches'),
raw.content.get0.\u数据感觉像是黑客攻击,所以我肯定错过了正确的方法。如何正确使用businessmatches记录,并使新记录集在模板上可用

编辑

从路由器:

setupController: function(controller, model) {
    controller.set('businessmatches', this.store.all('businessmatch'));
}
模型:

import DS from 'ember-data';

var Businessmatch = DS.Model.extend({
    businessname: DS.attr('string'),
    type: DS.attr('string')
});

export default Businessmatch;

什么是商业比赛?这是余烬数据记录吗?非常感谢!如果你想看一看的话,我已经发布了一篇文章,里面有一些我觉得很惊讶的东西。
test11: function(){
  // give me all the records that have the property foo that is 11
  var bms = this.get('businessmatches').filterBy('foo', 11);
  // give me all the records that have the property bar that is 12
  bms = bms.filterBy('bar', 12);
  // other filtering etc    
  return bms; 
  // watch foo/bar on each record, if they change, recompute this computed property
}.property('businessmatches.@each.{foo,bar,...}')