forked from maksrom/javascript-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogress.js
More file actions
executable file
·44 lines (36 loc) · 1.06 KB
/
progress.js
File metadata and controls
executable file
·44 lines (36 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
var Spinner = require('client/spinner');
var angular = require('./angular');
angular.module('progress', [])
.directive('progressSpinner', function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
var options = scope.$eval(attrs.progressSpinner) || {};
options.elem = element[0];
var spinner = new Spinner(options);
scope.$watch(attrs.progress, function(isLoading) {
if (isLoading) {
spinner.start();
} else {
spinner.stop();
}
});
}
};
})
.directive('progressOverlay', function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
var options = scope.$eval(attrs.progressOverlay) || {};
var type = options.type || 'light';
scope.$watch(attrs.progress, function(isLoading) {
if (isLoading) {
element.addClass('modal-overlay_' + type);
} else {
element.removeClass('modal-overlay_' + type);
}
});
}
};
});