mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-07 21:51:13 -07:00
27 lines
No EOL
1,005 B
JavaScript
27 lines
No EOL
1,005 B
JavaScript
(function() {
|
|
angular.module('ngLoadingSpinner', ['angularSpinner'])
|
|
.directive('usSpinner',
|
|
[
|
|
'$http', '$rootScope', function($http, $rootScope) {
|
|
return {
|
|
link: function(scope, elm, attrs) {
|
|
$rootScope.spinnerActive = false;
|
|
scope.isLoading = function() {
|
|
return $http.pendingRequests.length > 0;
|
|
};
|
|
|
|
scope.$watch(scope.isLoading,
|
|
function(loading) {
|
|
$rootScope.spinnerActive = loading;
|
|
if (loading) {
|
|
elm.removeClass('ng-hide');
|
|
} else {
|
|
elm.addClass('ng-hide');
|
|
}
|
|
});
|
|
}
|
|
};
|
|
|
|
}
|
|
]);
|
|
}).call(this); |