HTML:
<select [(ngModel)]='i.PaycodeId'>
<option *ngFor="let j of payCode" [value]='j.ID'>{{j.value}}</option>
</select>
payCode:
[{"ID":0,"value":"Cycle"},{"ID":1,"value":"Truck"},{"ID":2,"value":"Car"}]
In i.PaycodeId
, through ngModel
, it is setting numbers as string value not numbers like "1"/"2"
while the value passed to select is object having ID's value as number.
I want this value as number only.
i.PaycodeId
in the class?<tr *ngFor='let i of bonusArray'>
where bonusArray is an array or object which contains a number type value 'Paycode'. I am creating a table with the help of bonusArray array and drop down is one of it's column item. Now I contains an object with one of its property 'PaycodeId' and type of it is number. But when I select something from dropdown it returns my string instead of number as you can see it in my original post.