Angular Material 6 failing to open MatDialog with error: TypeError: this._document.createElement is not a function
See original GitHub issueBug, feature request, or proposal:
Bug
What is the expected behavior?
MatDialog will open
What is the current behavior?
Fails to open with:
at Overlay.push../node_modules/@angular/cdk/esm5/overlay.es5.js.Overlay._createHostElement (overlay.es5.js:3413)
at Overlay.push../node_modules/@angular/cdk/esm5/overlay.es5.js.Overlay.create (overlay.es5.js:3360)
at MatDialog.push../node_modules/@angular/material/esm5/dialog.es5.js.MatDialog._createOverlay (dialog.es5.js:780)
at MatDialog.push../node_modules/@angular/material/esm5/dialog.es5.js.MatDialog.open (dialog.es5.js:718)
at UploadComponent.push../src/app/components/upload/upload.component.ts.UploadComponent.openDialog (upload.component.ts:60)
at Object.handleEvent (upload.component.html:19)
at handleEvent (core.js:10043)
at callWithDebugContext (core.js:11136)
at Object.debugHandleEvent [as handleEvent] (core.js:10839)
at dispatchEvent (core.js:7502)
at core.js:7946
at HTMLInputElement.<anonymous> (platform-browser.js:1137)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:3751)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:496)
at invokeTask (zone.js:1540)
at HTMLInputElement.globalZoneAwareCallback (zone.js:1566)```
#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
```Angular CLI: 6.0.8
Node: 8.11.3
OS: win32 x64
Angular: 6.0.9
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cdk 6.2.1
@angular/cli 6.0.8
@angular/fire 5.0.0
@angular/material 6.2.1
@ngtools/webpack 6.0.8
@schematics/angular 0.6.8
@schematics/update 0.6.8
rxjs 6.2.1
typescript 2.7.2
webpack 4.8.3
Although I have tried with a large number of combinations of: Angular Material/CDK: 6.2.1, 6.31, 6.4.7 Angular CLI: 6.0.8, 6.2.3 Angular 6.0.9, ^6.1.7 rxjs: 6.2.1, 6.3.2 typescript: 2.7.2, 2.9.2 @angular-devkit/build-angular: 0.6.8, 0.7.1, 0.8.3
As per a number of tickets that are currently open or have been closed in this repository.
Is there anything else we should know?
This was working fine until I upgraded to Angular 6 from 5.
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
this._document.createElement is not a function angular
I was using the third party plugin for date and time picker plugin in this application, and it was conflicting with all materials....
Read more >can't bind to 'mat-dialog-close' - You.com | The search engine you ...
However, I am getting the following error thrown in the zone.js file: ... Open side panel. 'mat-dialog-actions' is not a known element in...
Read more >How to use Mat-Dialog in Angular ? - GeeksforGeeks
First we need to import 'MatDialog' from '@angular/material/dialog' and we need to create an instance for it in the constructor.
Read more >Implementing Modal Dialog Functions With Promise-based ...
Learn how to implement modal dialog functions with promise-based dialog results in your Angular application. See more from Wijmo today.
Read more >Angular Material Dialog: A Complete Example
This is a step-by-step tutorial, so I invite you to code along as we are going to start with a simple initial scenario....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@yharaskrik “ng-pick-datetime”: “5.2.6”, uses cdk 5. I have changed its version to 6.0.16 and now it seems to work for us.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.