-
-
Save ev0k3r/6039016 to your computer and use it in GitHub Desktop.
Revisions
-
kkurni renamed this gist
Feb 15, 2013 . 1 changed file with 8 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,16 +1,4 @@ KK.factory('httploadingInterceptor',['$q','$rootScope', function ($q, $rootScope) { return function (promise) { @@ -26,4 +14,11 @@ KK.factory('httploadingInterceptor',['$q','$rootScope', function ($q, $rootScope return $q.reject(response); }); }; }]); /* Example how to use it KK.config(['$routeProvider', '$httpProvider', function($routeProvider, $httpProvider) { //set loading interceptor $httpProvider.responseInterceptors.push('httpResponseInterceptor'); }]); */ -
kkurni revised this gist
Feb 15, 2013 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ KK.config(['$routeProvider', '$httpProvider', function($routeProvider, $httpProvider) { $routeProvider .when('/', { -
kkurni created this gist
Feb 15, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ KK.config(['$routeProvider', '$httpProvider', function($routeProvider, $httpProvider) { $routeProvider .when('/', { templateUrl: 'views/main.html' }) .otherwise({ redirectTo: '/' }); //set loading interceptor $httpProvider.responseInterceptors.push('httpResponseInterceptor'); }]); KK.factory('httploadingInterceptor',['$q','$rootScope', function ($q, $rootScope) { return function (promise) { $rootScope.loading = true; return promise.then(function (response) { // hide the spinner $rootScope.loading = false; return response; }, function (response) { // hide the spinner //$rootScope.loading = false; return $q.reject(response); }); }; }]);