[英]angular cannot enter the http.get function
This is my method to download data. 这是我下载数据的方法。 When I call
getRezerwacje(
), my console shows: 当我调用
getRezerwacje(
)时,控制台显示:
1,
4.
It seems like it's not entering the http.get()
function. 好像没有进入
http.get()
函数。 When I enter the URL in my browser I get data, so the API is working fine. 当我在浏览器中输入URL时,会得到数据,因此API可以正常工作。
getRezerwacje() {
console.log('1');
this.http.get('http://192.168.0.153:8090/api/rezerwacja/getPrzyjazdy')
.map(
(response: Response) => {
console.log('2');
const rezerwacje: Rezerwacja[] = response.json();
this.rezerwacjeService.wczytajRezerwacje(rezerwacje);
return rezerwacje;
}
)
.subscribe(
data => console.log(data),
err => console.log(err),
);
console.log('4');
}
Solved - i was using http library. 解决-我正在使用http库。 I switched to new HttpCLient library and it's working back again!
我切换到新的HttpCLient库,它又恢复了工作!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.