Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
MonthlyLeaders
ASK A QUESTION
Forumguidelines
AKhil kotha
2k
3
107
Appending Dynamic variable value to ng model of mat select is not work
Jan 13 2021 1:43 PM
<mat-select placeholder="Select Crop Type" [(ngModel)]="cropname" class="select" formControlName="croptype">
<mat-option *ngFor = "let i of Croptype" [value] = "i">{i.CropName}</mat-option> </mat-select>
In component.ts
Croptype = [ { CropID: '1', CropName: 'sweetlime', ScientificName: 'CitrusImetta' }, ];
this.cropname="sweetlime" when iam updating ng model value with below line the above issue occurs
The Example for the issue :https://stackblitz.com/edit/angular-be1gqv?file=src%2Fapp%2Fapp.component.html
In the above issue if [value]=i.Crop Name and Crop name value inside array and ng model value are same, then it is showing on dropdown ,but if [value]="i", it is not working. But based on our requirement we need to have complete object value in [Value].so please suggest how to resolve this issue
Reply
Answers (
1
)
Simplifying Known Vanilla JS to Advanced ES