[英]Unknown Provider for angular when creating filter in angularJS
我的過濾器($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;
}
無需使用過濾器,可以通過以下方式使用ng-class
:
<div ng-repeat=".." ng-class="{ row: ($index % 4 == 0) }">
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.