我有一个数组...
$scope.arr = ["first", "second", true];
我正在使用 ng-repeat 迭代并将每个索引值绑定(bind)到 <p>
像这样标记...
<div ng-repeat="value in arr">
<p ng-bind="value"></p>
</div>
我如何 ng-bind 数组中除最终索引之外的每个值 "last"
值(value)?喜欢...
<div>
<p>first</p>
</div>
<div>
<p>second</p>
</div>
最佳答案
您也可以尝试使用“limitTo”过滤器:
<div ng-repeat="value in arr | limitTo : arr.length-1">
<p ng-bind="value"></p>
</div>
关于javascript - Angular : how to iterate through all indices in an array except the final index using ng-repeat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39175343/