AngularJS:过滤不起作用

时间:2013-07-18 15:16:49

标签: javascript jquery search loops angularjs

我定义了ng-repeat

{"ng-repeat" => "city in cities() | filter: search"}

城市为{ attributes: {name: 'Boston'} }

这样的形式:

%input{:type => "search", "ng-model" => "search.attributes.name"}

但它不起作用,如何根据city.attributes.name进行过滤?

1 个答案:

答案 0 :(得分:1)

您的过滤条件应该是:

city in cities() | filter: {attributes: {name: search}}

然后将模型设置为搜索值:

%input{:type => "search", "ng-model" => "search"}