1
Google Maps Distance Matrix API https://developers.google.com/maps/documentation/distance-matrix/intro を使用して、ある座標で2点間の距離を計算する必要があります。
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」ステータスで応答を得るが、原因、次のエラーにそれを処理can`t: 私はAngularJSとAPIへのリクエストを実行するには、$ http.jsonp()メソッドを使用します
どうすれば解決できますか?事前にお手伝いしていただきありがとうございます