1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | import * as ng1 from 'angular';
|
9 | ngTablePagination.$inject = ['$compile', '$document', 'ngTableEventsChannel'];
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | export 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 |
|
\ | No newline at end of file |