Skip to content

Instantly share code, notes, and snippets.

View benschw's full-sized avatar

Ben Schwartz benschw

View GitHub Profile
@benschw
benschw / gist:5516070
Last active December 16, 2015 23:49
intercepting 401 responses from $http calls in AngularJS
angular.module('myApp', ['myApp.filters', 'myApp.services', 'myApp.directives'], function ($routeProvider, $locationProvider, $httpProvider) {
var interceptor = ['$rootScope', '$q', function (scope, $q) {
function success(response) {
return response;
}
function error(response) {
var status = response.status;