AngularJS IE 8支持 [英] AngularJS IE 8 Support

查看:189
本文介绍了AngularJS IE 8支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建一个单页的网站,使用AngularJS,UI路由器和jQuery,我需要它来支持IE浏览器8。结果
我跟着从AngularJS文档的说明(链接),我也读的这个并遵循其指示。结果
概括地说:我在标题中添加了这个$​​ C $ C:

I'm building a one-page website, using AngularJS, ui-router and jquery, and I need it to support ie 8 browsers.
I followed the instructions from the AngularJS documentation (link), and I also read this and followed its instructions.
In a nutshell: I added this code in the header:

<html xmlns:ng="http://angularjs.org" id="ng-app" ng-app="myApp">

和也:

<!--[if lt IE 9]>
    <script type="text/javascript" src="/app/js/3rdparty/html5shiv.js"></script>
    <script type="text/javascript" src="/app/js/3rdparty/json3.min.js"></script>
<![endif]-->

我所有的指令都仅限于用作属性的指令(没有自定义标签)。结果
但结果还是没有视图被渲染,并且没有指令的工作(在IE8)。

All of my directives are restricted to be used as attribute directives (no custom tags).
But still, no view is being rendered, and no directive is working (on ie8).

我开始使用UI的路由器只是在最近,在此之前甚至存在的问题。结果
我实在找不出问题了,我已经搜查了很多。结果
这有很多重复的,我知道,但没有自己的解决方案,帮助我(其中大部分pretty多参考angularjs的文档)。结果
我还没有发布任何其他code,因为有很多呢,我实在想不出什么code(比其他的index.html)的一部分,可以产生任何问题。< BR>
如果你认为它可以帮助我会发布的任何其他code。结果
我真的丢失,真的很感激,如果有人可以指导我一个解决方案。结果
非常感谢你。

I started using ui-router only recently, and the problem existed even before.
I really can't find the problem, and I've searched a lot.
There are many duplicates for this, I know, but none of their solutions helped me (and most of them pretty much refer to angularjs's documentation).
I haven't posted any other code, since there's a lot of it, and I really can't figure out what part of the code (other than the index.html) can be causing any problem.
I'll post any other code if you think it might help.
I'm really lost and would really be grateful if someone could guide me to a solution.
Thank you very much

推荐答案

好像我做了一个有点傻瓜了自己。结果
问题是,我使用了一些保留字,显然IE8真的不喜欢它。结果
比如我有一个对象命名为类的参数,因此,使用 obj.class 刚做IE8吓坏了。结果
与命名对象内的删除(再次,所以我使用功能相同的 functionHoldingObject.delete

Seems I made a bit of a fool out of myself.
The problem was that I was using some reserved words, and apparently IE8 really doesn't like it at all.
For instance I had a parameter named "class" on an object, so using obj.class just made IE8 freak out.
The same with a function named "delete" (again inside an object, so I was using functionHoldingObject.delete.

我知道保留字,我只是没有利用它们作为一个对象的参数是有害的想法。
为了解决这个问题,我只是改变了名称一段,并用的obj [reservedWord]​​ 为他人,这两个解决方案在所有浏览器。

I knew about reserved words, I just didn't think using them as a parameter of an object is harmful. In order to fix this, I just changed the names for some, and used obj["reservedWord"] for others, both solutions work on all browsers.

我发现另一个错误,是我用的是 Array.prototype.indexOf 函数不知道IE8不支持它。所以,我只是增加了一个实现(这是很容易)。结果
你可以得到的帮助上在 MDN 网站。

Another error I found, was that I was using the Array.prototype.indexOf function without knowing that IE8 doesn't support it. So I just added an implementation (which is very easy).
You could get help on that on the MDN site.

这篇关于AngularJS IE 8支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆