2016-07-26 154 views
0

我有以下代码:角度选择默认选项NG-需要

<select id="document" ng-model="document.Id" ng-options="option.Id as option.Name for option in documents" ng-required="IsDocumentRequired"> 
    <option value="">Please Select Document</option> 
</select> 

的问题是,我不希望这个默认值(“请选择文档”),以满足所需的NG-标志设置为true时。

总之,我希望用户被迫选择一个非默认选项。

感谢

+1

的回应现在不行吗? 'value =“”''

+0

@bboyk参见plunker演示 –

+0

只需使用'required'。这里没有要求使用'ng-required'。 – developer033

回答

0

不要使用

<option value="">Please Select Document</option> 

所以它不会显示它,用户应该从列表中选择一个项目

+0

谢谢,但是我需要选择框中的占位符文本 – bak