Code uitvoeren in Angular nadat de 'ng-repeat' klaar is

Op de volgende manier kun je code uitvoeren, pas als 'ng-repeat' klaar is. Html:
thing {{thing}}
Javascript:
function Ctrl($scope) {
  $scope.things = [
    'A', 'B', 'C'  
  ];
}

angular.module('myApp', [])
.directive('myPostRepeatDirective', function() {
  return function(scope, element, attrs) {
    if (scope.$last){
      // iteration is complete, do whatever post-processing is necessary
    }
  };
});

Bron: http://stackoverflow.com/a/13775176/40676

Reacties

Populaire posts van deze blog

[SQL Server] varchar vs nvarchar

MS Sql 70-461: Chapter 5

[C#] Class serialiseren en deserialiseren