Skip to content

Instantly share code, notes, and snippets.

@th3fallen th3fallen/taskService.js Secret
Created Dec 10, 2014

Embed
What would you like to do?
.directive('loading', ['$http', function ($http) {
return {
restrict: 'A',
link: function (scope, elm, attrs) {
scope.isLoading = function () {
return $http.pendingRequests.length > 0;
};
scope.$watch(scope.isLoading, function (v) {
if (v) {
elm.show();
} else {
elm.hide();
}
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.