Angular 2 TypeScript how to find element in Array

前端 未结 7 796
抹茶落季
抹茶落季 2021-01-29 21:35

I have a Component and a Service:

Component:

7条回答
  •  长情又很酷
    2021-01-29 21:49

    Use this code in your service:

    return this.getReports(accessToken)
            .then(reports => reports.filter(report => report.id === id)[0]);
    

提交回复
热议问题