IE11中不显示AngularJS 1.5

时间:2018-10-18 19:13:24

标签: angularjs

我有一个非CLI AugularJS程序,该程序未在IE 11中显示。 我已将以下内容添加到我的index.html中:

<script src="node_modules/core-js/client/core.min.js"></script>
<script src="node_modules/web-animations-js/web-animations.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/intl/dist/intl.min.js"></script>

我还需要做些什么才能使程序显示在Internet Explorer中? 在IE中,我的各种JS文件中的这些行均出现语法错误:

socketService.connect().then((socket) => {});
...
new_time.time_list = Array.from(new Array(new_time.max),....);
...
app.controller('AppCtrl', function($scope,$location) {
...

我看到了使用import和require()添加core-js和其他多边形填充的参考,但是该语法在AngularJS 1.5中对我不起作用。任何帮助表示赞赏!

1 个答案:

答案 0 :(得分:0)

问题是 IE11 不支持您使用的 javascript 版本。如下面的代码中所述,您正在使用箭头功能IE11 doesn't support。您还使用了其他 ES6 功能,例如is not supported either$this->db->insert('error_logging', $data);

Array.from

在简历中, IE11 对现代的 javascript 没有很好的支持。要移植代码以使其在这样的旧版浏览器中运行,您可以做的是使用babeljs ES6 转换为 ES5 代码,这在当今很普遍[2018]。还有es5-shimes6-shim可以扩展旧版浏览器的api级别,但是 ES6 + 语法细节仍然需要转换为 ES5 语法。