AngularJS:“错误:意外调用方法或属性 access.undefined"仅在 IE 8 中 [英] AngularJS: "Error: Unexpected call to method or property access.undefined" only in IE 8
问题描述
您是否曾在 IE8 中遇到过错误:意外调用方法或属性 access.undefined"的错误?是什么原因造成的?你是怎么解决的?
Have you ever had the error "Error: Unexpected call to method or property access.undefined" only IE8? What was causing it? How did you solve it?
-- 注意:假设相同的代码在 Chrome、Firefox、Safari 中运行良好
-- Note: It assumes the same code works fine in Chrome, Firefox, Safari
上下文
我正在使用 AngularJS + Google App Engine Python 构建一个 facebook 页面标签插件.
I'm building a facebook page tab plugin with AngularJS + Google App Engine Python.
我使用了十几个自定义指令,这些指令要么由我自己编写,要么由 angular-ui 团队和 4-5 个控制器编写.
I use a dozen custom directives either written by me or by the angular-ui team and 4-5 controllers.
在 Chrome、Safari 和 Firefox 中一切正常,但在 IE8 中则不然.
Everything works fine in Chrome, Safari and Firefox, but not in IE8.
推荐答案
问题是 IE8 无法识别自定义"元素.
The problem is that IE8 does not recognize "custom" elements.
在元素形式的指令声明中使用replace:true"(限制:'E')并使用 IE shiv(我使用了 angular-ui 的 IE shiv 并在那里声明了我的自定义标签).
Use "replace:true" in your directives declaration that are in element form (restrict: 'E') and use IE shiv (I used angular-ui's IE shiv and declared my custom tags there).
在以下链接中查看更多信息:https://github.com/angular/angular.js/issues/1933http://angular-ui.github.com/#ieshiv
See more on the links below: https://github.com/angular/angular.js/issues/1933 http://angular-ui.github.com/#ieshiv
这篇关于AngularJS:“错误:意外调用方法或属性 access.undefined"仅在 IE 8 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!