Reputation: 914
What I'm trying to do is Angular to get the value from an variable and put it on the first option, while the others below will be static. Angular is getting the data but the first option is always blank.
HTML
<select [(ngModel)]="sub_planning">
<option value="data[0].value" >{{data[0].name}}</option>
<option *ngFor="let c of subdimension" [ngValue]="c.value">{{c.name}}</option>
</select>
TS
sub_planning = '0';
subdimension = [{'name': 'oneabc','value': 1 },
{'name': 'twoabc','value': 2}];
I found some answers on the internet but it's on Angular 2 and it does't seems to work for Angular 4
Upvotes: 0
Views: 660