Angular2:对象在 Microsoft Edge 浏览器中不支持此操作
Angular2: Object doesn't support this action in Microsoft Edge browser
我的 angular2 应用程序抛出异常,指出 对象仅在 Microsoft edge 中不支持此操作。请检查下图:
我调试了一下发现promise然后代码抛出异常。更具体地说,我在下面的代码中收到错误:
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>
非常感谢任何帮助。
将 <meta http-equiv="x-ua-compatible" content="ie=edge">
放入您的 index.html
还要检查你的 polyfills 脚本并导入所有 core-js/es6/ 脚本
在 angular 项目文件夹中找到 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、Firefox、Internet Explorer 和 Safari 是常绿浏览器,即它们会自动更新,而不会提示用户。对于 Internet Explorer,大多数人认为这是指 IE10+。
问题出在以下代码中的 EventSource:
this.eventsource = new EventSource(this.configService.get("BaseURL"));
我通过添加 Event Source Polyfill js 解决了这个问题。我按照这个 EventSource Polyfill link 来安装 js。
感谢大家的帮助。
我的 angular2 应用程序抛出异常,指出 对象仅在 Microsoft edge 中不支持此操作。请检查下图:
我调试了一下发现promise然后代码抛出异常。更具体地说,我在下面的代码中收到错误:
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>
非常感谢任何帮助。
将 <meta http-equiv="x-ua-compatible" content="ie=edge">
放入您的 index.html
还要检查你的 polyfills 脚本并导入所有 core-js/es6/ 脚本
在 angular 项目文件夹中找到 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、Firefox、Internet Explorer 和 Safari 是常绿浏览器,即它们会自动更新,而不会提示用户。对于 Internet Explorer,大多数人认为这是指 IE10+。
问题出在以下代码中的 EventSource:
this.eventsource = new EventSource(this.configService.get("BaseURL"));
我通过添加 Event Source Polyfill js 解决了这个问题。我按照这个 EventSource Polyfill link 来安装 js。
感谢大家的帮助。