ng-repeat:过滤对象属性

时间:2015-05-22 13:56:44

标签: json angularjs angularjs-ng-repeat

以下代码未正确过滤结果:

<input placeholder="search" type="text" ng-model="q">
    <div ng-repeat="items in configuration.items | filter:{items.descr:q}">
      <div>
        <h3>{{items.descr}}</h3>
      </div>

为什么呢?实际上这个代码在这个json对象$configuration上完全不起作用:

{
    "descr": "Project - Configuration",
    "items": {
        "dangerous_components": {
            "descr": "Warning stuffs",
            "items": {
                "electrical_components": {
                    "descr": "electrical components here",
                    "values": [{
                        "key": "NOT_APPLICABLE",
                        "label": "N/A",
                        "svalue": null
                    }]
                }
            }
        }
    }
}

0 个答案:

没有答案