捕获http json主体响应,并在angular ionic5中转换为数组



我被卡住了,当我在这里和其他页面寻找时,我找不到适合的东西:/我想要的是将其提取出来并以一种方式将其用于在html中构建一个简单的表,看起来像

tbody> <<tr>(价值)
response count
(价值)(价值)
(价值)

修改

getPollResults(pollId): Observable<Pollresults>{
return this.http
.get<Pollresults>(this.base_path + '/polls/responses/' + pollId)
.pipe(
retry(2),
catchError(this.handleError)
)

}

getPollResults(pollId): Observable<Pollresults[]>{
return this.http
.get<Pollresults>(this.base_path + '/polls/responses/' + pollId)
.pipe(
retry(2),
catchError(this.handleError)
)

}

最新更新