Angular 2 - Setting selected value on dropdown list

前端 未结 8 1182
天命终不由人
天命终不由人 2020-12-04 16:29

I have run into an issue in pre-selecting values on a dropdown list in Angular 2.

I set an array of colours in the component which I bind successfully to the drop

8条回答
  •  被撕碎了的回忆
    2020-12-04 17:06

    I would like to add, [ngValue]="..." support strings, but you need to add simple quotes if it represents a number, like [ngValue]="'...'". It was to complement the Günter Zöchbauer answer.

提交回复
热议问题