UNPKG

1.37 kBJavaScriptView Raw
1/**
2 * ngTable: Table + Angular JS
3 *
4 * @author Vitalii Savchuk <esvit666@gmail.com>
5 * @url https://github.com/esvit/ng-table/
6 * @license New BSD License <http://creativecommons.org/licenses/BSD/>
7 */
8import * as ng1 from 'angular';
9ngTablePagination.$inject = ['$compile', '$document', 'ngTableEventsChannel'];
10/**
11 * Directive that renders the table pagination controls
12 * @ngdoc directive
13 */
14export function ngTablePagination($compile, $document, ngTableEventsChannel) {
15 return {
16 restrict: 'A',
17 scope: {
18 'params': '=ngTablePagination',
19 'templateUrl': '='
20 },
21 replace: false,
22 link: function (scope, element /*, attrs*/) {
23 ngTableEventsChannel.onAfterReloadData(function (pubParams) {
24 scope.pages = pubParams.generatePagesArray();
25 }, scope, function (pubParams) {
26 return pubParams === scope.params;
27 });
28 scope.$watch('templateUrl', function (templateUrl) {
29 if (templateUrl === undefined) {
30 return;
31 }
32 var template = ng1.element('<div ng-include="templateUrl"></div>', $document);
33 element.append(template);
34 $compile(template)(scope);
35 });
36 }
37 };
38}
39//# sourceMappingURL=ngTablePagination.directive.js.map
\No newline at end of file