1
Google Maps Distance Matrix API https://developers.google.com/maps/documentation/distance-matrix/intro 을 사용하여 좌표가있는 두 점 사이의 거리를 계산해야합니다. 내가 API에 요청 수행하고 $ http.jsonp() 메소드 AngularJS와를 사용
var app = angular.module('delivery', []);
app.controller('deliveryCtrl', function ($scope, $http) {
$scope.submit = function() {
var googleStr = 'https://maps.googleapis.com/maps/api/distancematrix/json?&origins=';
var fromPlace = autocompleteFrom.getPlace();
googleStr += fromPlace.geometry.location.lat() + ',' + fromPlace.geometry.location.lng();
googleStr += "&destinations="
var toPlace = autocompleteTo.getPlace();
googleStr += toPlace.geometry.location.lat() + ',' + toPlace.geometry.location.lng();
googleStr +='&key='+ apiKey+'&callback=JSON_CALLBACK';
$http.jsonp(googleStr).success(function (data) {
console.log(data);
}).error(function (data) {
$scope.error = true;
});
}
});
나는 상태로 응답을받을를 'OK',하지만 인해 다음 오류로 취급은`t :
어떻게 해결할 수 있습니까? 도움을 미리 요청 해 주셔서 감사합니다.