ng-table
Version:
Table + AngularJS ================= [](https://travis-ci.org/esvit/ng-table) [](https://coveralls.io/r/esvit/ng-table) [![seman
39 lines • 1.37 kB
JavaScript
/**
* ngTable: Table + Angular JS
*
* @author Vitalii Savchuk <esvit666@gmail.com>
* @url https://github.com/esvit/ng-table/
* @license New BSD License <http://creativecommons.org/licenses/BSD/>
*/
import * as ng1 from 'angular';
ngTablePagination.$inject = ['$compile', '$document', 'ngTableEventsChannel'];
/**
* Directive that renders the table pagination controls
* @ngdoc directive
*/
export function ngTablePagination($compile, $document, ngTableEventsChannel) {
return {
restrict: 'A',
scope: {
'params': '=ngTablePagination',
'templateUrl': '='
},
replace: false,
link: function (scope, element /*, attrs*/) {
ngTableEventsChannel.onAfterReloadData(function (pubParams) {
scope.pages = pubParams.generatePagesArray();
}, scope, function (pubParams) {
return pubParams === scope.params;
});
scope.$watch('templateUrl', function (templateUrl) {
if (templateUrl === undefined) {
return;
}
var template = ng1.element('<div ng-include="templateUrl"></div>', $document);
element.append(template);
$compile(template)(scope);
});
}
};
}
//# sourceMappingURL=ngTablePagination.directive.js.map