1

我如何每次在这里增加营地 3 而不是 1 ?

<div class="row" ng-repeat="camp in camps">
                <div class="col-lg-3">
            <img src={{camp.img}} alt="" height="200pt" width="250pt"/></div>
            <div class="col-lg-5 col-lg-offset-1">{{camp.email}}<br/>
            <span>{{camp.campname}}</span><br/>
            {{camp.about}}<br/>
            {{camp.tgtamt}}<br/>
            {{camp.enddate}}<br/><br/>
            <button id="view" class="btn btn-default" value1='{{camp.campname}}' value2='{{camp.email}}'>View</button>
            </div></div>
            <hr/>
        </div>
4

1 回答 1

0

您可以尝试使用$indexwith ng-show。就像是:

HTML

<div ng-controller = "myCtrl1"> 
 <div class="row" ng-repeat="camp in camps">
 <div ng-show="$index % 3 == 0"> <pre>{{camp.name}}</pre></div>          

    </div>
</div>

控制器

var myApp = angular.module('myModule', []);

myApp.controller('myCtrl1', ['$scope', function($scope) {
$scope.camps=
    [{name:"name_1"},{name:"name_2"},{name:"name_3"},{name:"name_4"},{name:"name_5"},
     {name:"name_6"},{name:"name_7"},{name:"name_8"},{name:"name_9"},{name:"name_10"}];    

}]);

输出:

name_1
name_4
name_7
name_10

Fiddle

于 2013-09-20T12:25:26.117 回答