Angular:如何使用ng-repeat迭代除最终索引外的数组中的所有索引(Angular: how to iterate through all indices in an array except the final index using ng-repeat)
我有一个数组...
$scope.arr = ["first", "second", true];我正在使用ng-repeat遍历并将每个索引值绑定到一个<p>标签,就像这样...
<div ng-repeat="value in arr"> <p ng-bind="value"></p> </div>除了最后一个索引"last"值之外,如何对数组中的每个值进行ng绑定? 喜欢...
<div> <p>first</p> </div> <div> <p>second</p> </div>I have an array...
$scope.arr = ["first", "second", true];I am using ng-repeat iterate through and bind each index value to a <p> tag like so...
<div ng-repeat="value in arr"> <p ng-bind="value"></p> </div>How do I ng-bind every value in the array except the final index "last" value? Like...
<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>You can also try using the "limitTo" filter:
<div ng-repeat="value in arr | limitTo : arr.length-1"> <p ng-bind="value"></p> </div>更多推荐
发布评论