I'm currently working on this piece of code and I need help figuring out how to return the value of rowData in this scenario.
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;}
Before returning, I attempted to console log rowData but it returned undefined.