问题
Angular 8 application with material 8 throws following error on IE11 when the material menu is opened:
Unable to get property 'opacity' of undefined or null reference
It worked well with angular 7.2. Used IE11 Version: 11.1146.16299.0 Update version: 11.0.125
New project dependency versions:
"dependencies": {
"@angular/animations": "^8.0.0",
"@angular/cdk": "^8.0.0",
"@angular/common": "~8.0.0",
"@angular/compiler": "~8.0.0",
"@angular/core": "~8.0.0",
"@angular/forms": "~8.0.0",
"@angular/material": "^8.0.0",
"@angular/platform-browser": "~8.0.0",
"@angular/platform-browser-dynamic": "~8.0.0",
"@angular/router": "~8.0.0",
"classlist.js": "^1.1.20150312",
"core-js": "^3.1.3",
"rxjs": "~6.5.2",
"tslib": "^1.9.0",
"web-animations-js": "github:angular/web-animations-js#release_pr208",
"zone.js": "~0.9.1"
}
Simple Menu
<mat-menu #appMenu="matMenu">
<button mat-menu-item>Menu Item 1</button>
</mat-menu>
<button mat-button [matMenuTriggerFor]="appMenu">
Menu
</button>
Already used pollyfills:
import 'classlist.js'; // Run `npm install --save classlist.js`.
import 'web-animations-js'; // Run `npm install --save web-animations-js`.
IE stack trace:
I verified the issue with a newly created angular 8 app containing only the menu in the app component.
Does anyone have any suggestion on how to solve this issue? Thanks
回答1:
Try adding import 'core-js/es/symbol';
to the polyfill
来源:https://stackoverflow.com/questions/56431642/material-ui-drop-down-menu-causing-error-in-ie11-after-updating-to-angular-8