Our team is currently working on a web application using AngularJS that requires calling REST API services from another application. However, due to it being a cross domain request, we are facing difficulties in making the calls and receiving the following error message (en.wikipedia.org/wiki/Same-origin_policy))
The error message states: "XMLHttpRequest cannot load . No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 400."
In our implementation, we are utilizing an angular service within our typescript module (docs.angularjs.org/api/ng/service/$http) as shown below:
////////
static $inject = ["$http"];
constructor(private $http: ng.IHttpService) {}
public testApi(): ng.IPromise<any> {
var baseUrl = "http://appserver:9090";
var data = {requestData};
var response = this.$http.post(url+"/checkAndUpdate", data);
return response;
}
/////
We would greatly appreciate any guidance on the best approach to resolving this issue using AngularJS. If there are any existing solutions available, please point us in the right direction.
Thank you.