Skip to content

Instantly share code, notes, and snippets.

@lykmapipo
Created December 10, 2015 07:57
Show Gist options
  • Save lykmapipo/3af3e30bfc1aa9ae46e9 to your computer and use it in GitHub Desktop.
Save lykmapipo/3af3e30bfc1aa9ae46e9 to your computer and use it in GitHub Desktop.
Sample snippets to handle angular http errors
.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