【问题标题】:ui-select2 placeholder with interpolation in angularjsui-select2占位符在angularjs中具有插值
【发布时间】:2016-09-22 23:00:08
【问题描述】:

我在 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 使用动态占位符。

提前致谢。

【问题讨论】:

  • 嗨,请制作演示,我可以帮忙,您需要输入类型隐藏或选择下拉
  • 可能重复:LinkLink

标签: angularjs interpolation placeholder ui-select2


【解决方案1】:

你可以试试这个,

<select id="listcategories" ng-options="item as item.label for item in items" ng-model="model">
<option value="">{{model.placeholderText}}</option>
</select>

【讨论】:

    【解决方案2】:

    在您的 HTML 页面中使用此代码

    <script>
        /*--  Select 2 Initialization  --*/
        $("#listcategories").select2({placeholder: "Select a font"});
    </script>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-15
      • 1970-01-01
      • 2013-07-31
      • 2011-08-30
      • 2018-02-19
      • 1970-01-01
      相关资源
      最近更新 更多