javascript - How to use limitTo with math expression (angular) -
i'm trying develop pagination buttons using ng-repeat this:
<li ng-repeat="(indexn, item) in objsch[indexo].nit | limitto: (math.ceil(indexn+1/10))"><a href="#">{{(math.ceil(indexn+1/10))}}</a></li>
this code checks how many items there in array, divide 10 , create tag match.ceil result on it.
unfortunaly, not work properly.
ps.: in controller put piece of code:
$scope.math = window.math;
someone have idea how solve using code way?
thanks!
ok, found solution. not sure if it's best solved problem.
the fixed code:
<li ng-repeat="(indexn, item) in objsch[indexo].nit | limitto: (math.ceil(objsch[indexo].nit.length/10))"><a href="#">{{indexn+1}}</a></li>
i set limitto using length of array instead of index , return index inside each button.
Comments
Post a Comment