Error in IE 11 browser - EXCEPTION: Object doesn't support property or method 'matches' , other browser it works fine

后端 未结 3 1763
滥情空心
滥情空心 2020-12-29 06:53

In my case, the webpage works fine in firefox and chrome browser but in IE v.11 it shows error as error comes in IE 11 DEVELOPER TOOLS. The error shows up in developer too

3条回答
  •  梦毁少年i
    2020-12-29 07:30

    For those using Angular 6 and 7 (typescript) you should modify Sanjay Gupta's answer below with:

    if (!Element.prototype.matches) {
      Element.prototype.matches = (Element.prototype).msMatchesSelector ||
        Element.prototype.webkitMatchesSelector;
    }
    

    The casting (well, untyping, really) allows the transpiler to parse the undefined method.

提交回复
热议问题