How to add placeholder text to dropdown

I am new to angularjs. I want to add a placeholder to my dropdown. I am not hard coding my dropdown values, it's coming from some where. Can you tell me where i did mistake.

<div class="row form-group">
    <label class="col-md-3">Action<span style="color: #b94a48">*</span></b></label>
    <div class="col-lg-3 col-md-7" style="padding: 0px;">
        <div class="dropdown select" style="width: 100%;">
            <select name="wlOrdActType" class="dropdown multiple" placeholder="-- Please Select --" 
                ng-model="wlOrdActType" 
                ng-options="obj.name as obj.name for obj in ordertypeList"
                style="width: 100%;">
                    <option></option>
            </select>
        </div>
    </div>
</div>

Here every thing is working. But placeholder is not place on the dropdown


<option value="" disabled selected>Please Select</option>

你可以做这样的事情:

<select ng-model="wlOrdActType" ng-options="obj.name as obj.name for obj in ordertypeList">
  <option value="" selected="selected">Choose one</option>
</select>

Could also try this:

<select required class="form-control" ng-model="myModel" 
ng-options="item as item.title for item in list">
    <option value="" label="-- Select option --" disabled selected="selected">      
    </option>
</select>

While having the model set to an empty string in the controller.

 $scope.myModel = "";
链接地址: http://www.djcxy.com/p/70600.html

上一篇: 在选择中隐藏第一个选项

下一篇: 如何将占位符文本添加到下拉菜单中