我有这个由分页元素生成的HTML:
var NewList
= OldList.Select(
x => new Class2{ locationID = x.locationID, locationName = x.locationName }
).ToList();
我想选择每个元素来添加一个类。 我试过了:
<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>
但我得到了“错误:value.addClass不是函数”
答案 0 :(得分:1)
UI分页的源代码在这里:
https://github.com/angular-ui/bootstrap/blob/master/src/pagination/pagination.js
AngularJS使用angular.element
执行jQuery类型DOM操作。该文档的文档如下:
https://docs.angularjs.org/api/ng/function/angular.element
在您审核完这些内容后,请返回HTML样本并提出更具体的问题。
<强>更新强>
使用ng-class
指令向元素添加类更容易。
有关ng-class
指令的详细信息,请参阅AngularJS ngClass API Reference
答案 1 :(得分:0)
我解决了使用angular.element(value);