【问题标题】:AngularJS: Filtering not workingAngularJS:过滤不起作用
【发布时间】:2013-07-18 15:16:49
【问题描述】:

我有一个ng-repeat 定义如下:

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

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

还有这样的表格:

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

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

【问题讨论】:

    标签: javascript jquery search loops angularjs


    【解决方案1】:

    你的过滤词应该是这样的:

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多