Winkelbeobachtung auf Änderungen in $ http.pendingRequests aus der Richtlinie
scope.isBusy = function () {
return $http.pendingRequests.length > 0;
};
scope.$watch(scope.isBusy, function (hasPending) {
if (hasPending) {
elm.show();
} else {
elm.hide();
}
});
You may want to put this in a directive like this:
.directive('loadingBoxDir', ['$http', function ($http) {
return {
restrict: 'A',
link: fn_link
};
function fn_link(scope, elm) {
scope.isBusy= function () {
return $http.pendingRequests.length > 0;
};
scope.$watch(scope.isBusy, function (hasPending) {
if (hasPending) {
elm.show();
} else {
elm.hide();
}
});
}
}]);
omostan