【发布时间】:2015-02-15 01:19:40
【问题描述】:
默认情况下,如果在 <select> 中没有选择任何内容,则 angular 使用空值。如何将其更改为显示Please select one 的文本?
【问题讨论】:
标签: angularjs ng-options angularjs-select
默认情况下,如果在 <select> 中没有选择任何内容,则 angular 使用空值。如何将其更改为显示Please select one 的文本?
【问题讨论】:
标签: angularjs ng-options angularjs-select
您没有提供任何代码,因此我无法给出与您的代码相关的示例,但请尝试添加选项元素,例如
<select ng-model="item" ng-options="item.category for item in items"
ng-change="doSomething()">
<option value="">Please select one</option>
</select>
【讨论】:
通过ng-selected 属性:
<select>
<option>Hello!</option>
<option ng-selected="selected">Please select one</option>
<option>Another option</option>
</select>
【讨论】: