Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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