hi, I have form ionic
HTML file:
<form #form="ngForm" (ngSubmit)="editprofile()" >
<ion-list >
<ion-item>
<ion-label stacked>{{'Fullname' | translate}}</ion-label>
<ion-input type="text" value={{profile.fullname}} [(ngModel)] ="dataProfile.fullname" name = "fullname" ></ion-input>
</ion-item>
<ion-item>
<ion-label stacked>{{'Email' | translate}}</ion-label>
<ion-input type="text" value={{profile.email}} [(ngModel)]="dataProfile.email" name = "email"></ion-input>
</ion-item>
</ion-list>
<button ion-button block (click)="editprofile()">{{'Update' | translate}}</button>
</form>
TS file:
editprofile(value: any): void{
let dataProfile ={
fullname : this.fullname,
email : this.email,
}
this.loadingprovider.showupdate(this);
this.profileService.upload(dataProfile)
.subscribe(data =>{
this.loading.dismiss();
this.navCtrl.setRoot(ProfilePage);
},(err)=>{
this.loading.dismiss();
})
}
And I have bug: ERROR TypeError: Cannot read property ‘fullname’ of undefined
I don’t understand @@.
How to solve it?