【问题标题】:Text being displayed twice in IE10文本在 IE10 中显示两次
【发布时间】:2015-05-11 21:44:40
【问题描述】:

我正在使用 AngularJS 开发一个带有下拉菜单的应用程序。 作为下拉菜单的默认值,我将其设置为“选择用途”。 在 Chrome、Firefox 和其他 IE 浏览器中显示正常。

仅在 IE10 中,它显示 2 个字符串,即“选择一个目的选择一个目的”。

之前有人遇到过这个问题吗? 有人可以向我提供一些关于为什么会发生这种情况或如何解决这个问题的指示吗?

这是我的代码 sn-p:

<select id="purpose_combo" ng-model="selectedFile.data.purpose" class="form-control"
            ng-disabled="selectedFile.purposeChoice == 'primary' || !selectedFile">
      <option selected hidden value="" translate>Select a Purpose</option>
      <option ng-repeat="item in purposeList" value="{{item}}"
              ng-selected="item == selectedFile.data.purpose">{{item}}</option>
</select>

谢谢

【问题讨论】:

  • 为什么在默认选项上需要“选择”,在额外选项上需要“ng-selected”?你可以尝试删除吗?可能,angular ng-model 会自己选择。

标签: angularjs internet-explorer-10


【解决方案1】:

尝试使用 ng-options:

<select id="purpose_combo" ng-model="selectedFile.data.purpose" class="form-control"
        ng-disabled="selectedFile.purposeChoice == 'primary' || !selectedFile"
        ng-options="item for item in purposeList">
  <option value="">Select a Purpose</option>
</select>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-14
    • 1970-01-01
    • 2014-05-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多