Hello, I'm currently working on an Ionic application that needs to display data in a Form Group after retrieving it with a SOAP ReadData request.
Although I call my function and try to display the data in the form, there seems to be an issue as the form is not appearing.
constructor(
public navCtrl: NavController,
public navParams: NavParams,
private privacyProvider: PrivacyProvider,
private formBuilder: FormBuilder
) {
this.myParam = navParams.get('myParam');
console.log(this.myParam);
this.getData().then(() => {
console.log(this.iobData);
debugger;
this.formData = this.formBuilder.group({
ID_INSTALLATO: new FormControl(this.iobData.id_installato),
ID_ANAGRAFICA: new FormControl(this.iobData.id_anag),
ID_PRODUTTORE: new FormControl(this.iobData.id_produttore),
ID_GRUPPO: new FormControl(this.iobData.id_gruppo),
ID_INSTALLATORE: new FormControl(this.iobData.id_installatore)
});
});
}
getData(){
return new Promise((resolve, reject) =>{
this.privacyProvider.getIOBData(this.myParam).subscribe((data)=>{
if (data) {
this.iobData = data;
resolve(true);
} else {
reject();
}
})
});
}
How can I resolve this issue? Here is my HTML code:
<ion-content>
<ion-list *ngIf="formLoaded">
<form [formGroup]="formData">
<ion-item>
<ion-label stacked>ID INSTALLATO</ion-label>
<ion-input formControlName="ID_INSTALLATO" type="text"></ion-input>
</ion-item>
<ion-item>
<ion-label stacked>ID ANAGRAFICA</ion-label>
<ion-input formControlName="ID_ANAGRAFICA" type="text"></ion-input>
</ion-item>
<ion-item>
<ion-label stacked>ID PRODUTTORE</ion-label>
<ion-input formControlName="ID_PRODUTTORE" type="text"></ion-input>
</ion-item>
<ion-item>
<ion-label stacked>ID GRUPPO</ion-label>
<ion-input formControlName="ID_GRUPPO" type="text"></ion-input>
</ion-item>
<ion-item>
<ion-label stacked>ID INSTALLATORE</ion-label>
<ion-input formControlName="ID_INSTALLATORE" type="text"></ion-input>
</ion-item>
</form>
</ion-list>