I am facing "Access Control Origin not Allowed" issue in AngularJS and based on AngularJS CORS Issues I have added following lines in my code:
angular.module('app', [
'ngRoute',
'appModules.filters',
'appModules.ajaxCallService'
])
.config(['$routeProvider', '$httpProvider', function($routeProvider, $httpProvider) {
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
$routeProvider.when('/login', {templateUrl: 'views/login.html', controller: 'LoginCtrl'});
}]);
But still I am facing issue:
XMLHttpRequest cannot load http://127.0.0.1:8000/login. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
Can anyone help me to solve this issue?
Even using localhost in URL I am getting same issue
XMLHttpRequest cannot load http://localhost:8000/login. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
I am using AngularJS version 1.2.16 and expressJS with 0.10.26 nodejs.