In my ionic project, I have added a form input for the stored Total amount by JS. It working fine, but I want to set my input non-editable. This is my ionic form input.
<ion-item class="layout-item"> <ion-input [(ngModel)]="total_amount[i]" type="text" placeholder="Total Amount"></ion-input> </ion-item>
How can I set it non-editable in Ionic?
[readonly]=”isReadonly()” is the best method to made input non-editable. If you want a non-editable input, you can apply readonly attribute in your form input. For example:
<ion-item class="layout-item"> <ion-input [(ngModel)]="total_amount" type="text" placeholder="Total Amount" [readonly]="isReadonly()"></ion-input> </ion-item>
After that put the js code in your ionic .ts page
isReadonly() {return true;}
Hope it will be helpful for you.
Question and answer is powered by AnsPress.io