We are developing a web application using AngularJS in which we want to 
call few rest api services from another application. It is a cross domain 
request, so we are not able to call it and we are getting the below error . 
(https://en.wikipedia.org/wiki/Same-origin_policy))


XMLHttpRequest cannot load http://appserver:9090/checkAndUpdate. 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.


We are using the angular service from our typescript module (httphttps://
docs.angularjs.org/api/ng/service/$http) like 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 like to know what is the best way to achieve this by AngularJS, 
please direct us if there is any existing solution.


Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to