Added loading spinner

This commit is contained in:
Jamie.Rees 2016-11-18 09:46:04 +00:00
parent f73d12e095
commit 63c2744336
6 changed files with 116 additions and 82 deletions

View file

@ -0,0 +1,25 @@
(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);