nexus site path corrected
[portal.git] / ecomp-portal-FE / client / bower_components / angular-smart-table / src / stPipe.js
1 ng.module('smart-table')
2   .directive('stPipe', ['stConfig', '$timeout', function (config, $timeout) {
3     return {
4       require: 'stTable',
5       scope: {
6         stPipe: '='
7       },
8       link: {
9
10         pre: function (scope, element, attrs, ctrl) {
11
12           var pipePromise = null;
13
14           if (ng.isFunction(scope.stPipe)) {
15             ctrl.preventPipeOnWatch();
16             ctrl.pipe = function () {
17
18               if (pipePromise !== null) {
19                 $timeout.cancel(pipePromise)
20               }
21
22               pipePromise = $timeout(function () {
23                 scope.stPipe(ctrl.tableState(), ctrl);
24               }, config.pipe.delay);
25
26               return pipePromise;
27             }
28           }
29         },
30
31         post: function (scope, element, attrs, ctrl) {
32           ctrl.pipe();
33         }
34       }
35     };
36   }]);