可见的元素,我想知道的是受一个NG-如果和NG-显示后显示可见元件的数量。这里是一个简化的例子:计数的NG-重复
$scope.fruits = [
{ name: 'apple', shape: 'round', color: 'red' },
{ name: 'stop sign', shape: 'pointy', color: 'red' },
{ name: 'orange', shape: 'round', color: 'orange' },
{ name: 'tomato', shape: 'round', color: 'red'}
];
<ul>
<li ng-repeat="fruit in fruits" ng-if="fruit.color=='red'" ng-show="fruit.shape=='round'">{{fruit.name}}</li>
</ul>
有没有一种方法来计算结果显示的项目数?
你是指结果项目的数量? –
是的。感谢您的期待,但我能弄明白:) – sleepycow