How To Set Default Value In Ionic 2 Input?
I want to set a default value in ionic input .. please help address.html file code {{'address.email'|translate}}
Solution 1:
You would do this with a normal [(ngModel)]
bind.
<ion-label floating>{{'address.email'|translate}}</ion-label>
<ion-input type="text" [(ngModel)]="user_email"></ion-input>
</ion-item>
Inside your TypeScript you would set the variable to a specific value when the page loads
*.component.ts
constructor() {
this.user_email = 'some@value.com';
}
This way when the user enters the screen, the value will be the default value and it still allows the user to update that value.
Solution 2:
You're looking for the "placeholder".
<ion-input placeholder="email@place.com"></ion-input>
Post a Comment for "How To Set Default Value In Ionic 2 Input?"