我的过滤器($index % 4 == 0)
正在抛出Error: [$injector:unpr] Unknown provider: (FilterProvider <- (Filter
问题:
如何使这个过滤器工作,以便我可以创建一个带有.row类的包装div;每4个内部项目?
HTML:
//Create a div with a class of .row for every 4 images
<div ng-repeat="(key, pageValue) in adPageData.pages" ng-class="row | ( $index % 4 == 0)">
//creates a div with a class of c4-sm which means 25% width
<div class="c4-sm" ng-repeat="(hotspotsKey, hotspotsValue) in pageValue.hotspots">
<img ng-src="{{hotspotsValue.tooltip_data.image}}" alt="" />
</div>
</div>
的CSS:
.c4-sm{
@include span(4);
}
.row:after {
content: "";
display: table;
clear: both;
}
答案 0 :(得分:0)
无需使用过滤器,您可以这样使用ng-class
:
<div ng-repeat=".." ng-class="{ row: ($index % 4 == 0) }">