Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 229600

Ionic 2 Form with ngModel

$
0
0

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?


Viewing all articles
Browse latest Browse all 229600

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>