发出http请求以打开天气api时发生未知错误

时间:2020-06-18 05:17:41

标签: angular stackblitz

我在我的stckblitz项目中进行了http呼叫

http://api.openweathermap.org/data/2.5/weather?q=' + data.city + '&appid=' + this.APIKey

但总是会给出错误

Http failure response for http://api.openweathermap.org/data/2.5/weather?q=london&appid=6492527f849e5034d485df6b5981d407: 0 Unknown Error

https://stackblitz.com/edit/angular-open-weather-app

1 个答案:

答案 0 :(得分:0)

您应该使用https版的网址:

https://api.openweathermap.org/data/2.5/weather?q=' + data.city + '&appid=' + this.APIKey