2
如何预先填充离子2离子输入字段?如何预填充离子2离子输入字段?
我试着做下面的,但字段保持空白。
<ion-input type="text" [(ngModel)]="product.content" name="content" value="123" required></ion-input>
如何预先填充离子2离子输入字段?如何预填充离子2离子输入字段?
我试着做下面的,但字段保持空白。
<ion-input type="text" [(ngModel)]="product.content" name="content" value="123" required></ion-input>
你可以这样做,如下所示。
.TS
product:any= {};
constructor(public navController: NavController) {
this.product.content='123';
}
注:不要使用any
。始终使用type
和TS
。我在这里只展示了简单的演示。
的.html
<ion-input type="text" [(ngModel)]="product.content" name="content"
required></ion-input>