占位符不在angularjs select2中工作

HD.*_*D.. 2 angularjs angularjs-select2

这是我尝试过的代码.我试图添加带有angularjs代码和HTML代码的占位符,但它不适用于这两种情况.请帮助我或建议我在这种情况下如何做

 <select ui-select2="select2Options" 
style="width:100%" 
ng-model="SelectedProcessandIngredients"
 data-placeholder="Select or Add Process/Ingredient" 
ng-options="c.name group by c.status for c in colors"
 ng-change="selectedinnerLoop()" >          
        </select>
Run Code Online (Sandbox Code Playgroud)

Angular js代码:

$scope.select2Options = {
        placeholder : "Select or Add Process/Ingredient",
        formatResult : processList,
        formatSelection : processList,
        escapeMarkup : function (m) {
        return m;
        }

    };
Run Code Online (Sandbox Code Playgroud)

Cai*_*tos 8

在select标记内添加一个空选项标记,将显示占位符.另外,使用ng-repeat代替ng-options.Select2与ng-options不兼容.

<select ui-select2 ng-model="select2" data-placeholder="Pick a number">
    <!-- empty option gets placeholder working -->
    <option value=""></option>
    <!-- ng-repeat to populate dynamic options -->
    <option ng-repeat="number in range" value="{{number.value}}">{{number.text}}</option>
</select>
Run Code Online (Sandbox Code Playgroud)