Ember.js 过滤模型并在控制器中进行设置

Ember.js 过滤模型并在控制器中进行设置,ember.js,ember-data,Ember.js,Ember Data,我基本上是根据一些属性对我的内容进行排序,并使用arrangedContent,这样我就可以得到sortedcontent了。现在,我想使用模型中的一些键(例如:name)过滤我的模型,并且只希望该内容显示在模板中。我想要的是,当我在搜索字段文本框中键入某个名称时,该内容应该被过滤,控制器只需显示应用了我的排序属性的过滤内容 {{#each arrangedContent}}......{{/each}} {{input type="text" action="search" valueBind

我基本上是根据一些属性对我的内容进行排序,并使用arrangedContent,这样我就可以得到sortedcontent了。现在,我想使用模型中的一些键(例如:name)过滤我的模型,并且只希望该内容显示在模板中。我想要的是,当我在搜索字段文本框中键入某个名称时,该内容应该被过滤,控制器只需显示应用了我的排序属性的过滤内容

{{#each arrangedContent}}......{{/each}}
{{input type="text" action="search" valueBinding="criteria"  placeholder="Search"}}
当我输入名称时,模型应该被过滤,arrangedContent应该只显示过滤后的内容
我是ember的初学者,无法找到做上述事情的方法。

我实现了一个类似的案例。继续使用
排列的内容

filteredContent: function(){
    var content = this.get('arrangedContent');
    // perform criteria on content
    // e.g.: content.findBy('name', criteria)
    return content;
}.property('arrangedContent.@each', 'criteria')
您的车把模板:

{{#each filteredContent}}......{{/each}}
{{input type="text" action="search" valueBinding="criteria"  placeholder="Search"}}
您将保留arrangedContent之外的优势,同时仍然可以修改它