Skip to content

Instantly share code, notes, and snippets.

@himetani himetani/myapp.js
Last active Aug 29, 2015

What would you like to do?
angular.module('myApp', ['ui.bootstrap', 'ui.router'])
.config(function($locationProvider, $stateProvider, $urlRouterProvider, $httpProvider){
enabled: true,
requireBase: false
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'
$httpProvider.interceptors.push(function($q, $location) {
return {
response: function(response) {
return response
responseError: function(response) {
if (response.status === 401) $location.url('/login')
return $q.reject(response);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.