How to disable ion-input?


#1

Just want to know if it is possible to disable the ion-input? I tried to put “disabled” and I was still able to enter text

Thanks


#2

[Disabled]=“expression”

Where expression is whatever you want it to be.

https://angular.io/docs/ts/latest/guide/forms.html


#3

Ideally you would be able to place the disabled attribute on ion-input and it would pass it down to the input element, but we’re not currently passing that attribute down. Created an issue:


#4

It works with static values but it doesn’t adding disabled attribute dynamically such as:

<ion-input [disabled]="isDisabled ? '' : null">


#5

Hi there ,

Is disable attribute working till now? I dont know why my code is not working.

  <ion-item>       
           <ion-label stacked>Property Type</ion-label>
               <ion-select [(ngModel)]="propType" (ionChange)="ionChanger()" disabled="false" >
                   <ion-option value="{{ptype}}" *ngFor="let ptype of PropTypeArray">{{ptype}}</ion-option>                 
               </ion-select>
       </ion-item>

I want to trigger disabled attribute in my ts code. but still not working.

<ion-select [(ngModel)]="propType" (ionChange)="ionChanger()" disabled="myEnableTsPars" >

#6

I tried disabling the ion-input and it’s working, but the opacity of the disabled style is not passed to the child tags, so the appearance of the ion-input does not change, even with the disabled attribute working.


#7

please edit your answer: [disabled]=“expression” - lowercase ‘d’

Blockquote Can’t bind to ‘Disabled’ since it isn’t a known property of ‘ion-input’.


#8

Good catch. Maybe it was because I posted that from my cellphonse. I tried to edit the message but I can’t :confused: