$index $first $middle $last $odd $evenhtml
htmlapp
<ul> <li ng-repeat="item in data" repeat-finish="renderFinish()">{{item.str}}</li> </ul>
指令函數
app.directive('repeatFinish',function(){ return { link: function(scope,element,attr){ console.log(scope.$index) if(scope.$last == true){ console.log('ng-repeat執行完畢') scope.$eval( attr.repeatFinish ) } } } })
ctrl裏面spa
//controller裏對應的處理函數 $scope.renderFinish = function(){ console.log('渲染完以後的操做') }