| .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