Error in IE 11 browser - EXCEPTION: Object doesn't support property or method 'matches' , other browser it works fine
I was facing same issue after I updated my project from Angular 5 to 6. I found a solution with help of Derek Brown's comment. The solution is to add the following in the polyfill.ts
file:
if (!Element.prototype.matches) { Element.prototype.matches = Element.prototype.msMatchesSelector;}
For those using Angular 6 and 7 (typescript) you should modify Sanjay Gupta's answer below with:
if (!Element.prototype.matches) { Element.prototype.matches = (<any>Element.prototype).msMatchesSelector || Element.prototype.webkitMatchesSelector;}
The casting (well, untyping, really) allows the transpiler to parse the undefined method.
It looks like IE implements the matches
function using a non-standard name (source). That link includes a polyfill which will define the matches
function so it can be used on IE.