jeudi 28 novembre 2019

mat-checkbox - how to get value from disabled checkbox

I need help in getting the value of disabled checkbox. I have two level of users, so for admins, checkbox should be available and for regulars users disabled. I have that case solved, but I have a problem when regular user submit the form, because value of "isActive" is undefined. Thats because its disabled... After some googling, I tried adding another input which is hidden, but thats not working too...

    <mat-checkbox class="mr-3" color="primary" [checked]="user.isActive" name="isActive" [ngModel]="user.isActive" [disabled]="!isAdmin">
        Active
    </mat-checkbox>

    <mat-checkbox hidden="true" name="isActive" [(ngModel)]="user.isActive"></mat-checkbox>



Aucun commentaire:

Enregistrer un commentaire