2013-07-18 112 views
0

我有一个ng-repeat定义为这样:AngularJS:过滤不工作

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

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

而且像这样一种形式:

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

但它不工作,如何我可以根据city.attributes.name进行过滤吗?

回答

1

您的过滤条件应该是这样的:

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

然后设置你的模型搜索的价值:

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

+0

它不工作,你确定吗?谢谢。 – Alex