frLitelay.js 605 Bytes
import '../jquery.litelay';

angular.module('fr.litelay', [])

.directive('frLitelay', function () {
    return {
        link: function (scope, element, attrs) {
            var last;

            scope.$watch(attrs.frLitelay, function (newValue) {
                if (newValue === last) {
                    return;
                }

                last = newValue;

                if (newValue) {
                    element.litelay({ off: false, spinner: true });
                } else {
                    element.litelay({ off: true });
                }
            });
        },
    };
});