This is my current code. How can I return rowData value in this case?
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;}
I had tried to console rowData before return and it gave me undefine.