2017-12-27 325 views
0

我的angular2应用程序抛出异常,说明对象仅在Microsoft Edge中不支持此操作。请检查下面的图片:Angular2:对象在Microsoft Edge浏览器中不支持此操作

enter image description here

enter image description here

我调试,发现该异常是在承诺抛出,则代码。更具体地讲,我得到的错误,然后在下面的代码:

this.dataLayerService 
      .postLogin(this.model, this.postURL) 
      .then(usermasterResponse => this.setToken(usermasterResponse)) 
      .catch(error => { 
        this.toastCommunicationService.setMessage(error, "", 
        this.toastCommunicationService.errorType) 
      }); 

我还增加了以下脚本index.html文件中,但它也枉然。

<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.34.1/es6-shim.js"></script> 

任何帮助将不胜感激。

在此先感谢。

回答

0

的问题是与的EventSource在下面的代码:

this.eventsource = new EventSource(this.configService.get("BaseURL")); 

我把它通过添加事件源填充工具JS解决。我跟着这个EventSource Polyfill链接安装了js。

谢谢大家的帮助。

0

<meta http-equiv="x-ua-compatible" content="ie=edge">在您的index.html 此外还要检查你的polyfills脚本,并导入所有核心JS/ES6 /脚本

+0

找不到polyfill.ts文件,你能帮我吗? –

+0

你是如何开始你的应用的? 有角起动器项目? –

+0

无论如何,你应该有你的src文件夹下的main.ts和polyfills.ts –

0

找到你polyfills.ts文件在您的角度项目文件夹,输入下面几行:

/** IE9, IE10 and IE11 requires all of the following polyfills. **/ 
import 'core-js/es6/symbol'; 
import 'core-js/es6/object'; 
import 'core-js/es7/object'; 
import 'core-js/es6/function'; 
import 'core-js/es6/parse-int'; 
import 'core-js/es6/parse-float'; 
import 'core-js/es6/number'; 
import 'core-js/es6/math'; 
import 'core-js/es6/string'; 
import 'core-js/es6/date'; 
import 'core-js/es6/array'; 
import 'core-js/es6/regexp'; 
import 'core-js/es6/map'; 
import 'core-js/es6/set'; 
import 'core-js/es7/array'; 

如果您正在使用网络的动画,所以你需要这样的:

/** IE10 and IE11 requires the following to support `@angular/animation`. */ 
import 'web-animations-js'; // Run `npm install --save web-animations-js`. 

常绿浏览器ÿ我们需要这样的:

/** Evergreen browsers require these. **/ 
import 'core-js/es6/reflect'; 
import 'core-js/es7/reflect'; 

长荣浏览器定义(original):

的Chrome,火狐,IE浏览器的最新版本,以及Safari是常绿的浏览器,即它们会自动静默更新自己不提示用户。对于Internet Explorer,大多数人认为这意味着IE10 +。

+0

无法找到polyfill.ts文件,请你帮我一下吗? –