Let's say I have this static object
allAccount = [
{ name: 'All Accounts', amount: 140853.47},
{ name: 'Credit Card ',amount: '-455.15' },
];
and I have mat-option interface with two values, name and amount.
<mat-form-field>
<mat-select>
<mat-option *ngFor="let item of allAccount" [value]="item.name">
<div class="flex justify-between">
<span>
{{ item.name }}
</span>
<span>
{{ item.amount }}
</span>
</div>
</mat-option>
</mat-select>
</mat-form-field>
This is within a mat-select, and once the user selects a choice, It display both item.name and item.amount in concatenated form, but [value]="item.name". How can I only show item.name when the user selects a choice in this case?
You can do the following:
Please find the Working stackblitz here