【问题标题】:Angularjs - MultiSelect dropdown options not displayed in IEAngularjs - IE中未显示多选下拉选项
【发布时间】:2018-06-06 04:43:22
【问题描述】:

我的应用程序有一个显示国家/地区的多选下拉菜单。此下拉菜单在 Chrome 中正确显示,在 IE 中显示如下选项:

我正在使用下面的代码(尝试将选择中的值更改为 ng-value 并且不起作用)-

HTML

<select multiple name="multiCountries" ng-model="vm.country.countryList">
   <option ng-repeat="option in vm.country.filteredList" value="{{option.value}}">{{option.label}}</option>
</select>

【问题讨论】:

  • 您可以尝试在select 元素中使用ng-options&lt;select multiple name="multiCountries" ng-model=vm.country.countryList" ng-options="option.value as option.label for option in vm.country.filteredList"&gt;&lt;/select&gt;
  • 谢谢,它的工作。你能把这个添加为答案,所以我会选择那个..
  • 如果您愿意接受,我已将我的评论添加为答案。

标签: javascript html angularjs


【解决方案1】:

您可以使用ng-options 而不是对选项元素本身执行ng-repeat。其一般格式是 [option value] 作为 [option text] for [option] in [list of options]。

.html

<select multiple name="multiCountries" ng-model=vm.country.countryList" ng-options="option.value as option.label for option in vm.country.filteredList"></select>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-03
    • 1970-01-01
    • 2021-03-07
    • 2023-01-08
    • 2019-02-10
    相关资源
    最近更新 更多