Angular UI Bootstrap 0.8.0手风琴在IE8中未显示所选值

Angular UI Bootstrap 0.8.0 accordion not showing selected value in IE8

本文关键字:显示 Bootstrap UI 手风琴 Angular IE8      更新时间:2023-09-26

我使用Angular UI Bootstrap 0.8.0和AngularJS 1.2.15来显示手风琴中的一些内容。其中一个手风琴包含一个带有输入/选择元素的窗体。我有一个选择下拉列表,上面有一个ng模型的国家列表,以显示所选的值。ng模型由select元素上的自定义指令"initialize model"初始化,该指令将模型初始化为HTML标记的value属性。这些选项是使用服务器端模板(ZPT)生成的。在其他所有浏览器中,当我选择一个国家/地区时,保存表格并再次打开页面。我看到了所选的国家/地区,但在IE8中,页面加载时没有正确设置ng模型,也没有选择任何国家/地区。如果我从手风琴中选择下拉菜单,IE8将显示所选的国家。

我遵循了angular的IE实践,包括document.createElement("ccordion");document.createElement('ccordion-group');document.createElement('ccordion-heading');对于IE8,但是IE8仍然没有显示所选择的值。当我打开IE8的开发工具并检查元素时,我可以看到select中的选项显示为selected,但ng模型没有设置为selected的值。我不知道是什么让ng模型被分配给选定的值,如果它在手风琴之外的话?我也尝试过在angular source之前包含jquery,但它仍然不能解决这个问题。

这就是模板的样子:

<html>
<head>
  <!--[if lte IE 8]>
    <script>
      document.createElement('accordion');
      document.createElement('accordion-group');
      document.createElement('accordion-heading');
    </script>
  <![endif]-->
</head>
<body>
  <accordion>
    <accordion-group is-open="showSection">
      <accordion-heading>
        <i ng-class="{'icon-chevron-down': showSection, 'icon-chevron-right': !showSection}"></i>Country Information
      </accordion-heading>
      <select ng-model="selected_country" id="selected_country" name="selected_country" initialize-model>
        <option value="">---------</option>
        <options tal:omit-tag="" tal:repeat="country countries">
          <option tal:attributes="value country/code" tal:content="country/country"></option>
        </options>
      </select>
    </accordion-group>
  </accordion>
</body>
</html>

我感谢在这方面的任何帮助!

由于没有人回答这个问题,我将在IE8中发布我为解决这个问题所做的工作。

我在UI引导手风琴的范围之外创建了另一个HTML元素,比如:

<select ng-model="selected_country2" id="selected_country2" name="selected_country2" initialize-model>

initialize-model指令初始化了来自服务器的这个下拉列表的值。

当加载页面时,我用指令外的元素值(selected_country2)初始化了手风琴指令内的模型(selected_dcountry)。这样,country的下拉列表中就填充了来自指令外元素的值。当用户更改国家/地区下拉列表时,会出现一个范围$watch语句,它在accordio指令之外更新下拉列表的值,并在POST使用更新的值时将其发送到服务器。

p.S:我确实看过UI引导程序网站,它并没有正式支持IE8。