Created
December 10, 2015 07:57
-
-
Save lykmapipo/3af3e30bfc1aa9ae46e9 to your computer and use it in GitHub Desktop.
Sample snippets to handle angular http errors
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 characters
.config(function($httpProvider) { | |
$httpProvider.interceptors.push(['$q', '$rootScope', function($q, $rootScope) { | |
return { | |
responseError: function(rejection) { | |
if (rejection.status === 403) { | |
$rootScope.$broadcast('403', rejection); | |
} | |
return $q.reject(rejection); | |
} | |
}; | |
}]); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment