How to perform readonly or disabled in ionic2?
10,887
I have used this to solve in Ionic 2:
In .ts file:
------------
isReadonly() {
return this.isReadonly; //return true/false
}
In .html file:
--------------
<ion-input type="text" [readonly]="isReadonly()"></ion-input>
Author by
Narendra Vyas
Updated on June 14, 2022Comments
-
Narendra Vyas almost 2 years
Actually i am trying to set a field as readonly or disabled in ionic2 form as:
<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>
I also used [readonly]="false".
I know it's an issue with also there are issues on git :
https://github.com/driftyco/ionic/issues/6408 ..
So any help how i could fix it out.