遇到这个错误有人帮忙,想在前端显示数据,数据存储在 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;
});
}
}
数据服务.ts
export class DataService {
uri = 'http://localhost:4000/data';
constructor(private http: HttpClient) { }
getthreads() {
return this
.http
.get(`${this.uri}`);
}
}