[英]Simple page using tab and accordion from angular ui-bootstrap fails to load in IE8
[英]Angular UI Bootstrap 0.8.0 accordion not showing selected value in IE8
我正在使用Angular UI Bootstrap 0.8.0和AngularJS 1.2.15来显示手风琴中的某些内容。 一种手风琴包含带有输入/选择元素的形式。 我正在选择下拉列表,上面有一个带有ng模型的国家/地区列表,以显示所选值。 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>
感谢您在这方面的帮助!
由于没有人回答这个问题,因此我将发布如何解决IE8中的问题。
我在UI-Bootstrap手风琴的范围之外创建了另一个HTML元素,例如:
<select ng-model="selected_country2" id="selected_country2" name="selected_country2" initialize-model>
initialize-model指令初始化了来自服务器的此下拉列表的值。
加载页面时,我使用手风琴指令内的元素值(selected_country2)初始化了手风琴指令内的模型(selected_country)。 这样,国家/地区的下拉菜单中就会填充来自指令外部元素的值。 当用户更改国家/地区下拉列表时,将显示一个scope。$ watch语句,该语句可在手风琴指令之外更新下拉列表的值,并且在使用更新后的值进行POST时将其转到服务器。
PS:我确实查看过UI-bootstrap网站,但它并不正式支持IE8。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.