I wrote some code like this:
html:
<li class="js-page-item" ng-repeat="page in pageList">{{page}}</li>
js:
$scope.pageList= [1,2,3,4,5,6];
var items = $('.js-page-item');
console.log(items.length); // =>0
It turns out that when the second line in js code was executed the list hadn't been finished yet. The first thing in my head is using $timeout to defer until the list had been finished. But, I don't think that is a good idea.
So, how can I know when the list has been finished?