2017-11-16 7 views
2

Ich bin neu in ionischen und habe ein Problem mit Textarea. Dies ist mein Code:Ionic 3 Wie benutze ich textarea ngModel und den Standardwert?

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

Das Problem ist, dass der Wert nicht innerhalb Textbox zeigt. Es wird nur angezeigt, wenn ich die [(ngModel)] entferne. Ich brauche Hilfe dafür Vielen Dank

Antwort

2

Sie müssen ion-textarea verwenden.

Hinweis: Dies ist nur ein Beispiel. Stellen Sie es so ein, wie Sie es wünschen.

Arbeiten 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

+1

Vielen Dank. Deine Anwher helfen mir, das Problem zu lösen. –

Verwandte Themen