How to set the value to mat-select?
<mat-select formControlName="project" >
<mat-option *ngFor="let project of projectList" [value]="project.projectid"
(click)="projectSelected(project.projectid)">
{{project.project_name}}
</mat-option>
</mat-select>
</mat-form-field>
I am trying to do it with this code, but it does not work.
this.form.patchValue({
'project.projectid': 1
});
I have created a fork at stackblitz, here is the link: https://stackblitz.com/edit/angular-wiccq5
I think your problem is with the
[value]
because it seems to expect a string and you are passing a number.