AngularJS: No "Access-Control-Allow-Origin" header is present on the requested resource [duplicate] AngularJS: No "Access-Control-Allow-Origin" header is present on the requested resource [duplicate] angularjs angularjs

AngularJS: No "Access-Control-Allow-Origin" header is present on the requested resource [duplicate]


This is a server side issue. You don't need to add any headers in angular for cors.You need to add header on the server side:

Access-Control-Allow-Headers: Content-TypeAccess-Control-Allow-Methods: GET, POST, OPTIONSAccess-Control-Allow-Origin: *

First two answers here: How to enable CORS in AngularJs


CORS is Cross Origin Resource Sharing, you get this error if you are trying to access from one domain to another domain.

Try using JSONP. In your case, JSONP should work fine because it only uses the GET method.

Try something like this:

var url = "https://api.getevents.co/event?&lat=41.904196&lng=12.465974";$http({    method: 'JSONP',    url: url}).success(function(status) {    //your code when success}).error(function(status) {    //your code when fails});