Ion-toggle allowing input while disabled


#1

I have the following code:

 <div class="inline-toggle">  
    <ion-label color="white" *ngIf="state">Online</ion-label>
    <ion-label color="white" *ngIf="!state">Offline</ion-label>
    <ion-toggle 
        [(ngModel)]="state"
        [disabled]="requestInProgress"
        (ionChange)="changeState($event)"
        color="brand-blue">
    </ion-toggle>
</div>

requestInProgress is a boolean that I use to disable and enable the toggle. However, the toggle is still allowing input when disabled. The toggle also has the disabled styles applied.


#2
 <ion-toggle 
        [(ngModel)]="state"
        (ionChange)="state=!state"
        color="brand-blue">
    </ion-toggle>

try this code


#3

Hi,

Ehm how would you fire off the change event in your example?


#4

then write this.state=!this.state in your change event Simple!!!