Google Map API方向指标API Cors错误

时间:2019-05-27 18:15:50

标签: google-maps cors angular7

我正在使用Google Map API获取两个位置之间的道路距离。为此,我使用distancematrix api。当我通过邮递员检查以下api调用时,它将正常工作并给出响应。

https://maps.googleapis.com/maps/api/distancematrix/json?origins=7.093542999999999,79.99370339999996&destinations=6.9336686,79.85004700000002&key=********

但是当我在我的angular 7服务中使用它并调用它时,它将在控制台中出现以下错误。

Access to XMLHttpRequest at 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=79.9024463,6.797514&destinations=80.02382869999997,7.0782922&key=********' from origin 'https://admin.snaplk.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

这是什么问题。

0 个答案:

没有答案