angular在IE下報object doesn't support property or method matches問題,以及router-outlet切換時不刪除原組件而是添加一個新組件

angular在IE下有時會報object doesn't support property or method matches問題

同時,在router-outlet切換時,不刪除原組件而是添加一個新組件,並將原組件擠到<router-outlet></router-outlet>下方

在polyfill.ts文件中添加如下代碼,即可解決上如題所述兩個問題。

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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章