To set and unset the mat-select value programatically

PHOTO EMBED

Tue Jan 05 2021 07:42:49 GMT+0000 (Coordinated Universal Time)

Saved by @eneki ##js

<form [formGroup]="selectInitiativeForm">
                <mat-form-field appearance="fill">
                    <mat-label>Select Initiative</mat-label>
                    <mat-select [formControlName]="'initiative'">
                        <mat-option *ngFor="let initiative of initiatives | async" [value]="initiative._id"
                            (click)="displayInitiativeData(initiative)">
                            {{ initiative.name }}
                        </mat-option>
                    </mat-select>
                </mat-form-field>
            </form>


 selectInitiativeForm = new FormGroup({
    initiative: new FormControl(''),
  });


redirectToHomePage() {
    this.selectInitiativeForm.controls['initiative'].setValue('');
    this.router.navigate(['/']);
 }
content_copyCOPY