我定义了ng-repeat
:
{"ng-repeat" => "city in cities() | filter: search"}
城市为{ attributes: {name: 'Boston'} }
这样的形式:
%input{:type => "search", "ng-model" => "search.attributes.name"}
但它不起作用,如何根据city.attributes.name
进行过滤?
答案 0 :(得分:1)
您的过滤条件应该是:
city in cities() | filter: {attributes: {name: search}}
然后将模型设置为搜索值:
%input{:type => "search", "ng-model" => "search"}