material icon indicating copy to clipboard operation
material copied to clipboard

mat-sidenav and mad-sidenav-container issues with 'TypeError: Cannot read property 'create' of undefined

Open physicsboy opened this issue 8 years ago • 2 comments

Bug, feature request, or proposal:

I have created a working app where there are no problems using your StackBlitz templates. However when refactoring my code to use the material components, I am coming up against the problem of console error surrounding the element with console showing:

TypeError: Cannot read property 'create' of undefined at MatSidenav.ngAfterContentInit (sidenav.js:326) at callProviderLifecycles

What is the expected behavior?

Expected behaviour is for this error not to occur such that I can use the component as expect and recreate what I made on StackBlitz

What is the current behavior?

See above for description

StackBlitz and steps to reproduce the issue:

StackBlitz Demo which shows your issue:
Detailed Reproduction Steps:

Basically the problem will be found within app.component.html... Everything is imported correctly and material components can be used as normal. However, the following tags make things fail...

Commenting these and their corresponding closing tags out, you are left with a that works fine... For some reason it seems to be the sidenav that is causing issues?

What is the use-case or motivation for changing an existing behavior?

Without the sidenav component, my code will need a lot more finessing and changing, and will not work in the way intended with simple material design components.

Which versions of AngularJS, Material, OS, and browsers are affected?

Angular 5 Material 5.1.1 Windows 10 Chrome

Is there anything else we should know? Stack Traces, Screenshots, etc.

physicsboy avatar Feb 02 '18 09:02 physicsboy

@physicsboy Sadly you missed the correct repository. Please have a look here: https://github.com/angular/material2

fsmeier avatar Feb 02 '18 10:02 fsmeier

Bugger - Thanks @IMM0rtalis !!

physicsboy avatar Feb 02 '18 10:02 physicsboy