Ionic 3 how to use textarea ngModel and default value?

17,642

You need to use ion-textarea.

Note: This is just an example.Adjust it as you wish.

Working stackblitz

html

 <ion-item>
  <ion-textarea placeholder="Tap here" 
      [(ngModel)]="note" name="note" autocomplete="on" autocorrect="on"></ion-textarea>
 </ion-item>

.ts

  note: string = "My Default Text";
  constructor(public navCtrl: NavController) {

  }

Offical doc about ion-textarea

Share:
17,642
Amelie Perrin
Author by

Amelie Perrin

Updated on August 17, 2022

Comments

  • Amelie Perrin
    Amelie Perrin almost 2 years

    I am new in ionic and have a problem with textarea. This is my code:

    <textarea  [(ngModel)]="userData.aboutme" name="" id="" cols="30" rows="20"  
        value="{{ about_me}}" style="width:100%; padding: 10px; margin-top: 3px;" > 
    </textarea>
    

    The problem is that the value is not showing inside textarea. It's show only if i remove the [(ngModel)]. I need help for this thanks a lot