Click here to Skip to main content
15,303,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
                                    name="dept" [(ngModel)]="deptList" multiple>
                                       <mat-option *ngFor="let dept of deptList" [value]="dept.Dept_Id">{{dept.Dept_Name}}</mat-option>

above is the my template code, deptList values are showing in the dropdown, but if i select the any value, it is getting disappearing. pls let me know how to handle multi select drop dwonl list with Angular matarial.

What I have tried:

also how to get the selected value in ts file.
Updated 18-Apr-21 23:53pm

1 solution

In your case, the value is wrong, it should be like this:
name="dept" [(ngmodel)]="deptList" multiple="">
<mat-option *ngfor="let dept of deptList" [value]="dept">{{dept.Dept_Name}}


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900