UNPKG

ng-table

Version:

Table + AngularJS ================= [![Build Status](https://travis-ci.org/esvit/ng-table.svg)](https://travis-ci.org/esvit/ng-table) [![Coverage Status](https://coveralls.io/repos/esvit/ng-table/badge.png)](https://coveralls.io/r/esvit/ng-table) [![seman

39 lines 1.37 kB
/** * 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