Skip to content

Instantly share code, notes, and snippets.

@himetani
Created July 29, 2015 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save himetani/19c9dfdd93ff94a0b00b to your computer and use it in GitHub Desktop.
Save himetani/19c9dfdd93ff94a0b00b to your computer and use it in GitHub Desktop.
angular.module('myApp', ['restangular'])
.run(function($rootScope, $state, Restangular, user) {
Restangular.setErrorInterceptor(function(response, deferred, responseHandler) {
if(response.status === 401) {
$state.go('login')
}
else if(response.status === 409) {
// send signal to SignupController
$rootScope.$broadcast('conflict')
}
return false
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment