Steve Ng
Steve Ng

Reputation: 1189

AngularJS ng-repeat in range not updating

First, I made an ajax call binding the data when the call returns

$scope.item = data;
$scope.$apply()

And I have a ng-repeat that does this

<li ng-repeat="n in range(item.length)" ng-class="{active: n ==currentPage}> {{n}} <li>

However the li element does not ever appear, any idea how?

Upvotes: 0

Views: 88

Answers (1)

Ye Liu
Ye Liu

Reputation: 8986

Try this:

<li ng-repeat="i in item" ng-class="{active: $index === currentPage}">{{$index}}<li>

Upvotes: 1

Related Questions