Ionic 3 如何使用 textarea ngModel 和默认值? [英] Ionic 3 how to use textarea ngModel and default value?
本文介绍了Ionic 3 如何使用 textarea ngModel 和默认值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是 ionic 新手,对 textarea 有疑问.这是我的代码:
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) {
}
这篇关于Ionic 3 如何使用 textarea ngModel 和默认值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文