Angular2:对象在Microsoft Edge浏览器中不支持此操作 [英] Angular2: Object doesn't support this action in Microsoft Edge browser
问题描述
我的angular2应用程序引发异常,指出对象不支持此操作,仅在Microsoft Edge中.请检查下图:
My angular2 application throws exception stating Object doesn't support this action only in Microsoft edge. Please check the below image:
我调试了一下,发现该异常是按约定然后代码抛出的.更具体地说,我在下面的代码处收到错误:
I debugged and found out that the exception is thrown at promise then code. To be more specific, I am getting the error at then on below code:
this.dataLayerService
.postLogin(this.model, this.postURL)
.then(usermasterResponse => this.setToken(usermasterResponse))
.catch(error => {
this.toastCommunicationService.setMessage(error, "",
this.toastCommunicationService.errorType)
});
我还在index.html文件中添加了以下脚本,但它也是徒劳的.
I have also added below script in the index.html file, but it was also in vain.
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.34.1/es6-shim.js"></script>
任何帮助将不胜感激.
推荐答案
问题在于以下代码中的 EventSource :
The issue was with the EventSource in the below code:
this.eventsource = new EventSource(this.configService.get("BaseURL"));
我通过添加事件源Polyfill js解决了它.我遵循了这个 EventSource Polyfill 链接来安装js.
I got it resolved by adding Event Source Polyfill js. I followed this EventSource Polyfill link to install the js.
感谢大家的帮助.
这篇关于Angular2:对象在Microsoft Edge浏览器中不支持此操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!