gpt4 book ai didi

angular - 如何在ionic2中执行只读或禁用?

转载 作者:行者123 更新时间:2023-12-03 23:30:57 24 4
gpt4 key购买 nike

实际上我正在尝试将 ionic2 形式的字段设置为只读或禁用:

<ion-item>
<ion-label fixed>Category <ion-icon name="ios-arrow-forward"></ion-icon></ion-label>
<ion-input type="text" [disabled]="false" id="category_name" class="form-control" formControlName="category_name" (click)="category()" [(ngModel)]="category_name"></ion-input>
</ion-item>

我也使用了 [readonly]="false"。

我知道这是一个问题,在 git 上也有问题:

https://github.com/driftyco/ionic/issues/6408 ..

所以任何帮助我可以解决它。

最佳答案

我在 Ionic 2 中使用它来解决:

  In .ts file:
------------
isReadonly() {
return this.isReadonly; //return true/false
}


In .html file:
--------------
<ion-input type="text" [readonly]="isReadonly()"></ion-input>

关于angular - 如何在ionic2中执行只读或禁用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41236306/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com