'Disable/Enable Input in Angular Mat Table with mat slide toggle
My question is i have a angular mat table in which i have a toggle and input text in each row , when i click on the toggle i need to disable/enable the input text of that particular row not all the inputs texts.
<ng-container matColumnDef="StudentToggle">
<th mat-header-cell *matHeaderCellDef> StudentToggle</th>
<td mat-cell *matCellDef="let element;let i = index" [formGroup]="element" >
<mat-slide-toggle formControlName="StudentToggle"
(click)="edit($event,element)"
>
</mat-slide-toggle>
</td>
</ng-container>
<ng-container matColumnDef="Marks">
<th mat-header-cell *matHeaderCellDef> Marks </th>
<td mat-cell *matCellDef="let element" [formGroup]="element">
<mat-form-field floatLabel="never">
<input [disabled]="element.Marks" matInputformControlName="Marks" placeholder="Enter Marks"
oninput="this.value = this.value.toUpperCase()" required>
<mat-icon matSuffix *ngIf="element.controls['isDeletable'].value">edit
</mat-icon>
</mat-form-field>
</td>
</ng-container>
**TS:**
edit(event,element){
// console.log("editClicked: +"+ event);
element.Marks= !element.Marks;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
