Show only open div with angular if

淺唱寂寞╮ 提交于 2019-12-05 21:24:07

Ok the best way to do this IMO is 2 fold, in your controller have a method similar to this

$scope.createDataChunks = function() {
    var a = $scope.DATA,
        retArr = [];
    while(a.length) {
       retArr.push(a.splice(0,3));
    }

    return retArr;
}

This would give you an array of arrays, each containing 3 (or less) items in it, you then have this as your markup

<div ng-repeat="data in createDataChunks()">
    <div class="conjunto-{{$index/3}} row" ng-show="$index % 3 == 0" ng-include="'html.html'">
        <!-- put custom HTML here -->
    </div>
</div>

I think that's roughly what you are after?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!