离子3如何使用textarea ngModel和默认值? [英] Ionic 3 how to use textarea ngModel and default value?
本文介绍了离子3如何使用textarea ngModel和默认值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是离子领域的新手,并且文本区域有问题. 这是我的代码:
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>
问题在于该值未在textarea内部显示.仅当我删除[(ngModel)]
时才显示.
为此,我需要帮助
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
推荐答案
您需要使用ion-textarea
.
注意:这只是一个示例.您可以根据需要对其进行调整.
Note: This is just an example.Adjust it as you wish.
工作 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) {
}
这篇关于离子3如何使用textarea ngModel和默认值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文