mercredi 9 décembre 2020

Angular Form Group

I am using angular material. i have formGroup array. my html file

<ng-container matColumnDef="locations">
                                <th mat-header-cell *matHeaderCellDef> Location(s) </th>
                                <td mat-cell *matCellDef="let row; let index = index"  [formGroupName]="index">
                                    <mat-form-field appearance="fill">
                                        <mat-label>Select Location</mat-label>
                                        <mat-select multiple formControlName="locations"  >
                                            <mat-option [disabled]="selectAll" *ngFor="let location of locations" [value]="location.checked"></mat-option>
                                        </mat-select>
                                    </mat-form-field>
                                </td>
                            </ng-container>

                            <ng-container matColumnDef="remote only">
                                <th mat-header-cell *matHeaderCellDef> Remote Only </th>
                                <td mat-cell *matCellDef="let row; let index = index"  [formGroupName]="index">
                                    <mat-checkbox
                                        formControlName="remote"
                                         (change)="updateCheck()"
                                         [(ngModel)]="selectAll"
                                
                                    ></mat-checkbox>
                                </td>
                            </ng-container>

my target is :

when I am select checkbox value that time automatically my dropdown items get selected and disabled in angular 7.




Aucun commentaire:

Enregistrer un commentaire