【发布时间】:2018-02-17 03:28:12
【问题描述】:
在我的 html 组件中,我有以下内容:
<select class="hideLabel form-control" [(ngModel)]="model.powerPlantType" name="powerPlantType" (change)="selectName();">
<option selected="" value=""></option>
<option [ngValue]="powerPlantType" *ngFor="let powerPlantType of powerPlantTypes">
{{ powerPlantType }}
</option>
</select>
从下面的屏幕截图可以看出,它显示良好:
如何在页面加载时添加一条显示“--Select Type--”文本的消息?
编辑:根据下面帖子的建议,我仍然无法让它工作:所以当页面加载时,下拉菜单仍然是空的,没有预期的默认测试“--Select Type--”
但是在选择下拉列表时似乎出现了测试!
我宁愿在页面加载时也这样:
【问题讨论】:
标签: angular angular2-template dropdown