I am trying to get places using google place api in my controller:
$http.get("https://maps.googleapis.com/maps/api/place/radarsearch/json?location=51.503186,-0.126446&radius=5000&type=museum&key=MY_KEY")
.then(function(response) {
$scope.results = response.data;
console.log($scope.results);
});
Unfortunately this doesn't work. After my console.log, I get the following error.
XMLHttpRequest cannot load https://maps.googleapis.com/maps/api/place/radarsearch/json?location=51.503…126446&radius=5000&type=museum&key=MY_KEY. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9004' is therefore not allowed access.
BTW this is not unique to localhost as I have tried the same in a live server. What is the google angularjs way to achieve this?