Subscribe to observable is returning undefined

后端 未结 6 707
面向向阳花
面向向阳花 2020-12-01 07:27

So I am trying to subscribe to a simple service that return data from a local JSON file.

I have managed to get the service working, I can log it out in the function

6条回答
  •  [愿得一人]
    2020-12-01 07:31

    objResponse;
    this.service.getData().subscribe((result: any)=> { 
    this.objResponse=result;
    }
    

    Returning something won't required

提交回复
热议问题