问题描述
我的 angular2 应用程序仅在 Microsoft Edge 中抛出异常,指出 对象不支持此操作.请检查下图:
My angular2 application throws exception stating Object doesn't support this action only in Microsoft edge. Please check the below image:
我调试并发现异常是在promise然后代码处抛出的.更具体地说,我在下面的代码中收到错误:
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 浏览器中不支持此操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!