Created
September 10, 2015 14:21
-
-
Save carbonrobot/d467a6c297422cda963d to your computer and use it in GitHub Desktop.
Prevent preflight for CORS in Angular
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.config(['$routeProvider', '$httpProvider', function($routeProvider, $httpProvider) | |
{ | |
// product overview | |
$routeProvider | |
.when('/products', { | |
templateUrl: 'views/products.html', | |
controller: 'ProductsController' | |
}) | |
// default | |
.otherwise({ | |
redirectTo: '/products' | |
}); | |
// prevent preflight request for cross-domain Ajax calls | |
$httpProvider.defaults.useXDomain = true; | |
delete $httpProvider.defaults.headers.common['X-Requested-With']; | |
}]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment