草庐IT

html - IE8 问题 : AngularJS ng-include - partials with HTML5 node structure

coder 2023-08-07 原文

关于 AngularJS ng-includes 的快速问题,其中局部部分具有 HTML5 节点结构,即:页眉、导航、页脚...

在我的标题中,我提供了使 Angular 在 Internet Explorer 8 及更低版本中正常运行的所有重要内容。

所有 ng-view 和 ng-includes 都按预期工作。

<!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<!-- Internet Explorer AngularJS element creation -->
<!--[if lte IE 8]>
    <script>
        document.createElement('ng-include');
        document.createElement('ng-pluralize');
        document.createElement('ng-view');
        document.createElement('ng:include');
        document.createElement('ng:pluralize');
        document.createElement('ng:view');
    </script>
    <script src="http://cdnjs.cloudfare.com/ajax/libs/json3/3.2.4/json3.min.js"></script>
<![endif]-->

问题是部分中有一个 HTML5 节点。

假设:partial在partials中被称为header。

<ng-include src="'partials/header.partial.html'"></ng-include>

示例 1(header.partial.html 源 - 在 IE8 中不显示)

<header>
    <h1>logo</h1>
</header>

示例2(header.partial.html源码-IE8显示)

<div>
    <h1>logo</h1>
</div>

我已经包含了来自 angular 的 require 脚本以及 html5 shim。

如果我将部分内容移动到根文件,一切都很好。

想法?

最佳答案

这似乎与问题 #1381 有关.简而言之,jqlite 中的克隆方法在它不理解的标签上放置了一个空的命名空间,因此 html5 标签显示如下 <:header>而不是 <header> .如果您使用完整版本的 jquery,这可能会得到解决。或者你可以修补 Angular (见上面的问题)。根据这篇文章的年代,这个问题似乎在 github 和这里已经死了。谷歌群组 ( Problems with jQuery and ng:include in Internet Explorer ) 也有相关问题。

关于html - IE8 问题 : AngularJS ng-include - partials with HTML5 node structure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15118758/

有关html - IE8 问题 : AngularJS ng-include - partials with HTML5 node structure的更多相关文章

随机推荐