user1477955
user1477955

Reputation: 1670

Angular JS - How to detect that that ng-repeat has finished?

How can I detect that ng-repeat has finished writing the values into the markup? I have a lot of values and the rendering will take some time.

NG

        <ul >

        <li data-ng-repeat="item in values"> 

           {{item.id}}           

        </li>
    </ul>

Upvotes: 2

Views: 95

Answers (1)

Michael Kang
Michael Kang

Reputation: 52847

Use $timeout service.

$timeout(function(){
    //done rendering...
 });

Pass false as the third argument to prevent another digest cycle if you don't need one:

$timeout(function(){
    //done rendering...
 },0,false);

You can inject the $timeout service in your controller function:

app.controller('ctrl', function($scope, $timeout){
   ...
});

Upvotes: 1

Related Questions