我在angularjs应用程序中使用ui-select2,并且我想使用动态占位符文本,当我尝试使用以下代码时,
<input id="listcategories" type="hidden" data-placeholder= '{{model.placeholderText}}' data-ui-select2="{multiple: false, width:'100%'}" data-model="model" data-ng-model="model.value" data-ng-disabled="model.readOnly" />它如下图所示。

有人能帮我在ui-select2中使用动态占位符吗?
提前谢谢。
发布于 2016-05-25 19:25:37
在您的HTML页面中使用此代码
<script>
/*-- Select 2 Initialization --*/
$("#listcategories").select2({placeholder: "Select a font"});
</script>发布于 2016-05-25 19:41:28
你可以试试这个,
<select id="listcategories" ng-options="item as item.label for item in items" ng-model="model">
<option value="">{{model.placeholderText}}</option>
</select>https://stackoverflow.com/questions/37435451
复制相似问题