San

San

  • NA
  • 804
  • 325.3k

Bind drop down option in Angular 5

Apr 10 2019 11:24 AM
Belo option bind on ngOnInit()  after call the service data and bind the option it is working fine.
 
this.Service.Loadspecial().subscribe(result=>{
this.specialdata=result;
});
 
 
<select (change)="selectOption2($event.target.value)" class="form-control" style="height:3rem;">
<option value="0">--Select --</option>
<option [value]="special.specialID" *ngFor="let special of specialdata" >
{{special.specialname}}
</option>
</select>
 
I need some condition directly bind {{special.specialname}} in option how to implement.
Not need for selecting the option in existing record.
 

Answers (2)