기본 콘텐츠로 건너뛰기

10월, 2016의 게시물 표시

angularjs http interceptor using spinner example

<script type="text/javascript" src="/vendor/angular-spinner/angular-spinner.js"></script> .factory('httpInterceptor', function ($q,usSpinnerService, $rootScope, $log) {             var numLoadings = 0;             return {                 request: function (config) {                     numLoadings++;                     // Show loader                     // $rootScope.$broadcast("loading-started");    usSpinnerService.spin('spinner-1');                     return config || $q.when(config)                 },                 response: function (response) {                     if ((--numLoadings) === 0) {                         // Hide loader                         // $rootScope.$broadcast("loading-complete"); usSpinnerService.stop('spinner-1');                     }                     return response || $q.when(response);                 },                 responseError: