【发布时间】:2015-01-03 19:31:47
【问题描述】:
我正在使用 Angular UI Bootstrap 0.8.0 和 AngularJS 1.2.15 在手风琴中显示一些内容。其中一个手风琴包含一个带有输入/选择元素的表单。我有一个选择下拉列表,其中列出了带有 ng-model 的国家/地区列表,以显示所选值。 ng-model 由 select 元素上的自定义指令“initialize-model”初始化,该元素将模型初始化为 HTML 标记的 value 属性。这些选项是使用服务器端模板 (ZPT) 生成的。在其他所有浏览器中,当我选择一个国家/地区时,保存表单并再次打开页面,我会看到所选国家/地区,但在 IE8 中,页面加载时 ng-model 设置不正确,并且没有选择国家/地区。如果我从手风琴中取出选择下拉菜单,IE8 会显示所选国家/地区。
我遵循了 Angular 的 IE 实践,包括 document.createElement('accordion');document.createElement('accordion-group');document.createElement('accordion-heading');对于 IE8,但 IE8 仍然不显示所选值。当我打开 IE8 的开发人员工具并检查元素时,我可以看到选择中的选项显示为已选择,但 ng-model 未设置为所选值。如果它在手风琴之外,我不知道是什么让 ng-model 被分配给选定的值?我也尝试在角度源之前包含 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>
感谢您在这方面的任何帮助!
【问题讨论】:
标签: javascript angularjs internet-explorer-8 angular-ui-bootstrap