0

I am building an app with Angular 1.1.5. It has a Google Place autocomplete and I store the place id and reference on my backend.

I would like to fetch the places JSON on the client side (formatted address and name: no details and no map) based on the stored place id and reference. This is because I prefer not to store the places data on my server.

I have the following "silly" service:

angular.module('MyServices')
  .factory 'GooglePlaces', ($http) ->
      $http {
         method: 'GET'
         url: 'https://maps.googleapis.com/maps/api/place/details/json?reference=CmRYAAAAciqGsTRX1mXRvuXSH2ErwW-jCINE1aLiwP64MCWDN5vkXvXoQGPKldMfmdGyqWSpm7BEYCgDm-iv7Kc2PF7QA7brMAwBbAcqMr5i1f4PwTpaovIZjysCEZTry8Ez30wpEhCNCXpynextCld2EBsDkRKsGhSLayuRyFsex6JA6NPh9dyupoTH3g&sensor=true&key=MYAPPKEY'
}

I works great in a web browser, but I get a is not allowed by Access-Control-Allow-Origin error.

What is the best practice to get data from place id and reference?

4

0 回答 0