I'm new with Ionic and i want to make a CRUD ionic app with Back4app. I managed to create some class and the datas within it, using the app, but i have no idea how to Read (all data) and put it in a List within my app. Can someone help me?
this is my ts file
export class UnitFormPage {
voucherList: VoucherModel[] = []
constructor(public navCtrl: NavController, public navParams: NavParams) {
}
private readAllData(){
let Vouchers = Parse.Object.extend("Voucher");
let query = new Parse.Query(Vouchers);
query.find().then((result)=>{
this.voucherList = result //this List contains null, but in console it did fetch the data
if (typeof document !== 'undefined')
// document.write(`Voucher found: ${JSON.stringify(result)}`);
console.log('Voucher found', result);
}, (error) => {
// if (typeof document !== 'undefined') document.write(`Error while fetching Voucher: ${JSON.stringify(error)}`);
console.error('Error while fetching Voucher', error);
})
}
my model class
export class VoucherModel{
public id: number = 0;
public unitRequestor: string = "";
public picRequestor: string = "";
public unitTujuan: string = "";
public jenisPermintaan: string = "";
public deskripsiPermintaan: string = "";
public tglPermintaan: string = "";
public jamPermintaan: string = "";
}
this is part of my view class
<ion-item-sliding *ngFor="let item of voucherList" >
<ion-item >
<ion-grid item-end no-padding>
<ion-row>
<ion-col >
<ion-label style="font-size: 20px; font-weight: bold;">{{item.unitRequestor}}</ion-label>
</ion-col>
</ion-row>
the object did show in console but not in app. Any help appreciated.