Reputation: 12005
I use this code in template of component:
<select class="form-control" [(ngModel)]="selectedInvoice">
<option>{{ "select" | translate }}</option>
<option *ngFor="let item of invoices" [value]="item.AC_id"
>{{ item.AC_code }} - {{ item.AC_name }}</option
></select
>
Below I tried to show selected value:
{{selectedInvoice}}
It returns nothing always.
Component is:
export class SelectInvoiceDialog {
public selectedInvoice: number;
}
Upvotes: 0
Views: 56
Reputation: 3104
How does the invoices
array look? Does it have AC_id
as a property in its' objects? Your code looks fine, my guess would be that you typed AC_id
by mistake and you actually where looking for [value]="item.AC_code"
?
Upvotes: 1