i am try to create a SPA with Angular. I have to consume the a service form different server. It is a java based service. Here i am getting "No 'Access-Control-Allow-Origin' header is present on the requested resource"
angular.module('tableApp', [])
.config(function ($httpProvider) {
//Enable cross domain calls
$httpProvider.defaults.useXDomain = true;
$httpProvider.defaults.withCredentials = true;
delete $httpProvider.defaults.headers.common["X-Requested-With"];
$httpProvider.defaults.headers.common["Accept"] = "application/json";
$httpProvider.defaults.headers.common["Content-Type"] = "application/json";
//Remove the header used to identify ajax call that would prevent CORS from working
delete $httpProvider.defaults.headers.common['X-Requested-With'];
})
.controller('tableCtrl', ['$scope', '$http', '$timeout', function ($scope, $http) {
var bassURL = 'http://[server ip]:8080/ABC/resource/XYZ'
$http.get(bassURL + '/getTypes').success(function (Type) {
$scope.Type = Type;
});
}
])
Please help.