简体   繁体   中英

Click event on button is not working in Internet explorer

I am using Angular 9, I have a button, it is working fine on all browser, but not on Internet Explorer, even I am not able to click on button.

My code:

 <button *ngIf="config.xlsxAll" type="button" class="btn btn-success" (click)="exportRecords(true)">
         <i class="fa fa-download"></i> XLSx All
      </button>

I tried button tag by replacing with div tag, but it didn't worked for me. What I did wrong? Thanks in advance

browser-support document for angular 9

https://github.com/angular/angular/blob/9.1.x/aio/content/guide/browser-support.md

 Browser Supported versions IE 11, 10, 9 ("compatibility view" mode not supported)

Solution: Unfortunately, there is no solution to this problem. Angular roadmap will soon turn off support for all IE versions . However, you can suggest moving the user to a new browser.

in index.html

<body>
  <!--[if lt IE 11]>
<p>
  You are using an <strong>outdated</strong> browser. Please
  <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.
</p>
<![endif]-->

...

Solution 2: Check src/polyfill.ts

in polyfill.ts

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


/** IE10 and IE11 requires the following for NgClass support on SVG elements */
 import 'classlist.js';  // Run `npm install --save classlist.js`.


/*
 * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
 * with the following flag, it will bypass `zone.js` patch for IE/Edge
 */
(window as any).__Zone_enable_cross_context_check = true;

import 'zone.js/dist/zone'; // Included with Angular CLI.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM