mfrancois
11/29/2013 - 6:05 PM

Angular directive for send end when render is finish

Angular directive for send end when render is finish

<div>
    <div ng-repeat="car in cars" on-finish-render="initTransformation()"  ng-animate="'animate'">
        <label>{{car.libelle}}</label>
    </div>
</div>
var main = angular.module('main', []).controller('mainCtrl', function ($scope) {
                
        $scope.initTransformation = function () {
                jQuery($element).jqTransform();
                $scope.isStarted = true;
        };
});

main.directive('onFinishRender', function ($timeout) {
    return {
        restrict: 'A',
        link: function (scope, element, attr) {
            if (scope.$last === true) {
                $timeout(function () {
                    scope.$eval(attr.onFinishRender);
                });
            }
        }
    }
});