【发布时间】:2014-07-24 06:49:03
【问题描述】:
我想过滤 ng-repeat 以便它只显示存在所有键/值对的行。
HTML
<div ng-app="myApp" ng-controller="oneController">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>Country</th>
<th>1960</th>
<th>1970</th>
</tr>
<tbody>
<tr ng-repeat="country in countries | orderBy: country.name">
<td>{{country.name}}</td>
<td>{{country.1960 | number}}</td>
<td>{{country.1970 | number}}</td>
</tr>
</tbody>
</table>
Javascript
angular.module('myApp', []).
controller('oneController', function($scope) {
$scope.countries = [
{"name":"Aruba", "1960":"1567"},
{"name":"Andorra","1960":77865,"1970":78360},
];
});
因此,在此示例中,我不希望显示 Aruba,仅显示 Andorra。
完整示例@CSSDeck:http://cssdeck.com/labs/1aksiuuu(我不想显示 Aruba)
【问题讨论】:
标签: javascript angularjs filtering angularjs-ng-repeat ng-repeat