How to make the input filed in the ionic form as read only?


#1

please help me i am trying to make the input field as read only . tried with this code but not working

view:

      <ion-input type="text"  [readonly]="readonly"
            name="branch_no" [(ngModel)]="user.BRANCH_ID" >
      </ion-input>

ts file:

export class CustomerInfo{

 readonly:boolean;

 constructor(){
   this.readonly=true

  }
}

#2

#3

still the bug is not fixed ?


#4

Maybe a workaround is not displaying an ion-input when the field is readonly?

like

<ion-input *ngIf="!readonly" ....>

<label class="mystyle" *ngIf="readonly"...>

Or something like that, just an idea