-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloading-spinner.js
More file actions
35 lines (35 loc) · 1013 Bytes
/
loading-spinner.js
File metadata and controls
35 lines (35 loc) · 1013 Bytes
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
angular.module('loading-spinner', []).directive('loadingSpinner', function(){
return {
restrict: 'A',
scope: true,
replace : false,
link : function(scope, element, attributes)
{
var loader = $('<span class="request-spin"><i class="fa fa-circle-o-notch fa-spin"></i></span>');
scope.$watch(attributes['loadingSpinner'], function(newValue, oldValue){
if (newValue) {
element.append(loader);
} else {
$(loader).remove();
}
}, true);
}
};
}).directive('overlaySpinner', function(){
return {
restrict: 'A',
scope: true,
replace : false,
link : function(scope, element, attributes)
{
var overlay = $('<div class="overlay-spinner"><span class="request-spin"><i class="fa fa-circle-o-notch fa-spin"></i><span></div>');
scope.$watch(attributes['overlaySpinner'], function(newValue, oldValue){
if (newValue) {
element.append(overlay);
} else {
$(overlay).remove();
}
}, true);
}
}
});