이것은 현재 코드입니다. 이 경우 rowData 값을 어떻게 반환 할 수 있습니까?각도 4 반환 값이 정의되지 않았습니다.
private createRowData() {
const rowData: any[] = [];
this.http
.get(`/assets/json/payment.json`)
.toPromise()
.then(response => response.json())
.then(data => {
data.items.map(elem => {
rowData.push({
id: elem.id,
total_amount: elem.total_amount,
status: elem.status,
sent: elem.sent,
});
});
});
return rowData;}
돌아 가기 전에 rowData를 조작하려고했는데 정의되지 않았습니다.
가능한 복제 [비동기 호출의 응답을 반환하는 방법?] (https://stackoverflow.com/questions/14220321/how-to-return-the-response-from-an-asynchronous- 전화) (TL, DR : 당신은 할 수 없습니다. 마지막'.then' 호출로 만들어진 약속을 되돌려 야합니다.) –