I want to do implement edit profile functionality.
i’m showing the value into the text box to the user for edit.
Like This
<ion-label floating>Name</ion-label>
<ion-input type="text" [(ngModel)]="getUser.user_name" name="name"></ion-input>
</ion-item>
i want to get the edited value from the text box using [(ngModel)]
.how can i do that?
you most use change event
like this
<ion-item>
<ion-label fixed>username:</ion-label>
<ion-input type="text" [(ngModel)]='username'
(change)='onChange($event.target.value)'>
</ion-input>
</ion-item>
onChange(data) : void {
console.log("text: " + data);
# or
console.log(this.username);
}
@mm Sir getUser.user_name
carry the json response.how can i change. if i changed ng module name is not showing the value into the text field.
This is my HTM
<ion-list *ngIf="getUser">
<ion-item>
<ion-label floating>Name</ion-label>
<ion-input type="text" [(ngModel)]="getUser.user_name" name="name1"></ion-input>
</ion-item>
<ion-item>
<ion-label floating>Email</ion-label>
<ion-input type="Email" [(ngModel)]="getUser.user_email" name="email"></ion-input>
</ion-item>
<ion-item>
<ion-label floating>Phone</ion-label>
<ion-input type="text" [(ngModel)]="getUser.user_phone" name="phone"></ion-input>
</ion-item>
<ion-item>
<ion-label floating>Password</ion-label>
<ion-input type="text" [(ngModel)]="getUser.user_password" name="password"></ion-input>
</ion-item>
<button ion-button full (click)="editProfile();" color="danger">Edit</button>
</ion-list>
Thanks