frInfiniteScroll.js 865 Bytes
import '../services/frInfiniteScrollCtrl';
import '../../vendor/ng-infinite-scroll';

// @depends: _gaq (Google Analytics), DataStore
angular.module('fr.infiniteScroll', ['fr.infiniteScrollCtrl', 'infinite-scroll'])

.directive('frInfiniteScroll', ['$compile', 'infiniteScrollCtrl', function ($compile, infiniteScrollCtrl) {
    return {
        restrict: 'A',
        priority: 1000,
    	terminal: true,
        compile: function (element, attrs) {
            element.removeAttr('fr-infinite-scroll');

            element.attr('infinite-scroll', 'infiniteScroll()');
            element.attr('infinite-scroll-disabled', 'infiniteScrollDisabled');

            // Linking function.
            return function (scope, element) {
                infiniteScrollCtrl(scope, element);

                $compile(element)(scope);
            };
        },
    };
}]);