<选择>带有角度/引导程序的占位符不起作用 [英] &lt;select&gt; placeholder with angular/bootstrap not working

查看:21
本文介绍了<选择>带有角度/引导程序的占位符不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在带有引导程序的 angularjs 中选择一个带有占位符的选择.我发现的解决方案不适用于angular

I would like to have a select with a placeholder in angularjs with bootstrap. The solutions I have found do not work with angular

这是我的角度标记:

<select ng-model="myModel" 
     ng-options="p.name for p in ..."
     class="form-control list-selector required">
   <option value='' disabled selected>Please Choose</option>
</select>

如果有人有可行的解决方案...

If someone has a working solution...

谢谢:)

推荐答案

您需要在您的选择中添加一个空选项:

You need to add an empty option to your select:

<option value="">- Please Choose -</option>

这是一个工作示例:http://jsfiddle.net/DianaNassar/FShdc/

这篇关于<选择>带有角度/引导程序的占位符不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆