如何在控制台的angular 7中显示此API的响应 我的component.ts文件中的功能代码是
getAllOrderBooks(){
this.toDoListArray = [];
this.toDoService.getallOrderBooksS().subscribe((res) => {
console.log(" binance res", res);
// this.toDoListArray = res.data;
// this.toDoListArray = res;
console.log("Array fetched",this.toDoListArray);
}, err=>{
console.log("Error occured in fetching all items")
});
}
,对于service.ts是
getallOrderBooksS(){
const url = "https://api.binance.com/api/v1/depth?symbol=BTCUSDT&limit=5";
console.log("Endpoint being hit", url);
return this.http.get(url);
}