Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/409.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript IE 11 AngularJS错误-对象不';t支持属性或方法';从';_Javascript_Html_Angularjs_Internet Explorer 11 - Fatal编程技术网

Javascript IE 11 AngularJS错误-对象不';t支持属性或方法';从';

Javascript IE 11 AngularJS错误-对象不';t支持属性或方法';从';,javascript,html,angularjs,internet-explorer-11,Javascript,Html,Angularjs,Internet Explorer 11,在我的JavaScript中,我有一个函数detectenvironment和getleandedepot(),它通过HTML被称为onload。我正在使用wicket,需要获取后端保存的值,因此我将它们发送到屏幕,隐藏它们,并从我的JS中搜索值以查找名称值,例如if(v.getAttribute('name')=='LE'){do stuff}或if(v.getAttribute('name')=='depot'){do stuff}(我肯定不是最优雅的解决方案,但我需要一个快速的解决方案!)

在我的JavaScript中,我有一个函数
detectenvironment和getleandedepot()
,它通过HTML被称为
onload
。我正在使用wicket,需要获取后端保存的值,因此我将它们发送到屏幕,隐藏它们,并从我的JS中搜索
值以查找
名称
值,例如
if(v.getAttribute('name')=='LE'){do stuff}
if(v.getAttribute('name')=='depot'){do stuff}
(我肯定不是最优雅的解决方案,但我需要一个快速的解决方案!)然后在函数
detectenvironmentandgetleandedepot()
中,我进行了一些格式化等操作,以便数据可用

detectenvironmentandgetleandedepot()
函数(相当长,仅相关部分)——

当我在IE11中打开它时,我在弹出的
SCRIPT438中得到一个错误:对象不支持属性或方法'from'
,它与上面方法的第一行相关,即
Array
类。非常感谢您的帮助。

正如Mozilla所解释的那样,
Array.from
函数还不受IE支持


您可以将\u下划线.js与函数
\u.toArray(document.getElementsByTagName('span'))
一起使用

供参考:

以下文档模式不支持“Array.from”:怪癖、Internet Explorer 6标准、Internet Explorer 7标准、Internet Explorer 8个标准,Internet Explorer 9个标准,Internet Explorer 10 标准,Internet Explorer 11标准。Windows不支持 8.1


作为
数组。IE不支持from
方法,您可以尝试使用:

[].slice.call(document.getElementsByTagName('span')).forEach(function(v) {});

这不需要使用任何第三方库。

您可以使用ES2015 polyfill,例如,或

这似乎可以工作。但是,我将代码改回了Array.from-并且它也可以工作。我的应用程序似乎异常喜怒无常(在IE中),有时有效有时无效。除此之外,我一打开开发人员工具,一切都会中断……我甚至没有一个开始的位置。我讨厌IE。@notAChance我从未使用过Angular,但我在同一问题上寻求帮助时遇到了它(也使用
Array.from()
)。听起来您的代码的气质可能与同一问题有关;在错误的时间/在加载文档之前加载。
[].slice.call(document.getElementsByTagName('span')).forEach(function(v) {});