当我点击一个API端点控制台时,显示为null

时间:2019-05-08 06:58:45

标签: angular api

如何在控制台的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);
      }

0 个答案:

没有答案