"类型错误:对象没有´t支持这个未定义的动作“;Angular应用程序IE8中的错误
"TypeError: Object doesn´t support this actionundefined" bug in IE8 with Angular app
"TypeError:Object不支持此操作undefined"当我尝试执行我的angular应用程序时,这是IE8控制台中的消息。Angular并没有执行它应该执行的任何操作。有人能为解决这个问题提供建议吗?我已经包括了json2和ui ieshiv。我也用这种方式写了html标签:
<html xmlns:ng="http://angularjs.org" class="ng-app:app" ng-app="app" id="ng-app">
祝你一切顺利!
当我在IE8中运行我的angular应用程序时,有3件事是IE8不喜欢的。
1) console.log函数。在angular被引导之前,我不得不把这个javascript放在页面中:
// Avoid `console` errors in browsers that lack a console.
(function() {
var method;
var noop = function () {};
var methods = [
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
'timeStamp', 'trace', 'warn'
];
var length = methods.length;
var console = (window.console = window.console || {});
while (length--) {
method = methods[length];
// Only stub undefined methods.
if (!console[method]) {
console[method] = noop;
}
}
}());
2) toISOString函数
/*IE8 toISOString hack */
if (!Date.prototype.toISOString) {
Date.prototype.toISOString = function() {
function pad(n) { return n < 10 ? '0' + n : n }
return this.getUTCFullYear() + '-'
+ pad(this.getUTCMonth() + 1) + '-'
+ pad(this.getUTCDate()) + 'T'
+ pad(this.getUTCHours()) + ':'
+ pad(this.getUTCMinutes()) + ':'
+ pad(this.getUTCSeconds()) + '.'
+ pad(this.getUTCMilliseconds()) + 'Z';
};
}
3) forEach函数
/*IE8 hack to support forEach */
if (!Array.prototype.forEach) {
Array.prototype.forEach = function(fn, scope) {
for(var i = 0, len = this.length; i < len; ++i) {
fn.call(scope, this[i], i, this);
}
}
}
请注意,这些都不是我自己写的。。我从SO.那里"挖掘"了它
这些都是我为了在IE8中运行而不得不修复的罪魁祸首。现在,它运行良好。
问题解决了我发现IE8和插件Angular Restful之间存在问题。当我把它拿走时,我的应用程序又恢复了工作。
相关文章:
- webRTC错误未定义配置
- gmaps4rails 2.4.6未捕获引用错误:未定义Gmaps
- 未捕获引用错误:未定义validateform
- 为什么我会出现此错误"未捕获引用错误:未定义标题;
- Sitecore”;未捕获引用错误:未定义MultilistWithSearch;
- Wordpress:未捕获引用错误:未定义速度
- Node.js引用错误:未定义类名
- Replace()产生“;未捕获的类型错误:未定义的不是函数“;当与零一起使用时
- 错误-未定义easeInBounce
- 未捕获的引用错误:未定义<映射键>
- 未捕获的类型错误:未定义不是上的函数.GetElementByID
- Javascript错误:未捕获引用错误:未定义编辑
- javascript onchange取消绑定错误|未定义
- requirejs优化器错误:未定义窗口
- 未捕获引用错误:未定义PrintThisPage
- JSHint 错误:未定义我的应用程序 (W117)
- 当我编写脚本时,它显示引用错误:未定义宽度
- socket.io - 引用错误:未定义 io
- 反应.js:未捕获类型错误:未定义不是一个函数
- 出现“未捕获的类型错误:未定义不是函数”控制台错误