How to set a selected value in mat-select?


I am listing a list of values in mat-select. Here is my code;

<div class="row">
                                    <div class="col-md-1">
                                        <mat-form-field class="mat-form-field-fluid">
                                            <mat-select placeholder="select" formControlName="myList" id="myList">
                                                <ngx-mat-select-search [formControl]="frmControl" #fltr >
                                                </ngx-mat-select-search>
                                                <mat-option id="myListValue" [value]="item.code"  *ngFor="let item of ListOfSelect | filterByProperty: ['descp',filter.value];">{{ item.description}}
                                                </mat-option>
                                            </mat-select>
                                        </mat-form-field> 
                                    </div>

I want to add a new value to this list and also make it as selected value.

How can I do that?

Source: JavaSript – Stack Overflow

November 22, 2021
Category : News
Tags: angular | html | javascript | mat-select | typescript

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.