得到这个错误的帮助,想要在前端显示数据,数据存储在dynamodb本地数据库中,我使用get API调用。
display.component.html文件
<tbody>
<h1> Testing</h1>
<tr *ngFor="let thread of threads " >
<td>{{ thread.threadId }}</td>
<td>{{ thread.threadType }}</td>
<td>{{ thread.createDate }}</td>
<td>{{ thread.updateDate }}</td>
<td>{{ thread.channelName }}</td>
</tr>
</tbody>
display.component.ts文件
threads : thread[];
constructor(private bs: DataService) { }
ngOnInit() {
this.bs.getthreads().subscribe((data: thread[]) => {
this.threads = data;
});
}
}
data.service.ts
export class DataService {
uri = 'http://localhost:4000/data';
constructor(private http: HttpClient) { }
getthreads() {
return this
.http
.get(`${this.uri}`);
}
}
答案 0 :(得分:0)
请尝试这个。
getthreads() {
return this
.http
.get(`${this.uri}`)
.map(result=>result["Items"]);
}