This is my method to download data. When I call getRezerwacje(
), my console shows:
1,
4.
It seems like it's not entering the http.get()
function. When I enter the URL in my browser I get data, so the API is working fine.
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. I switched to new HttpCLient library and it's working back again!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.