我有这个由分页元素生成的 HTML:
<ul class="pagination ng-isolate-scope ng-valid" ng-change="gestTrt.pageChanged()" ng-model="gestTrt.currentPage" items-per-page="1" total-items="4" direction-links="false" aria-invalid="false">
<li class="pagination-page ng-scope" ng-class="{active: page.active,disabled: ngDisabled&&!page.active}" ng-repeat="page in pages track by $index" style="">
<li class="pagination-page ng-scope" ng-class="{active: page.active,disabled: ngDisabled&&!page.active}" ng-repeat="page in pages track by $index" style="">
<li class="pagination-page ng-scope" ng-class="{active: page.active,disabled: ngDisabled&&!page.active}" ng-repeat="page in pages track by $index" style="">
<li class="pagination-page ng-scope active" ng-class="{active: page.active,disabled: ngDisabled&&!page.active}" ng-repeat="page in pages track by $index" style="">
</ul>
我想选择每个元素来添加一个类。我试过了:
angular.forEach(angular.element(document.querySelector(".pagination")).children(), function(value, key){
value.addClass('active');
但我得到“错误:value.addClass 不是函数”