components icon indicating copy to clipboard operation
components copied to clipboard

getting 'md-content' is not a known element: MdSidenavLayout@0:165 when using latest builds

Open qdouble opened this issue 10 years ago • 5 comments

I just updated to the latest builds and I'm getting this error when trying to load my project. I've tried it on 7-4 and 7-9, the same thing occurs.

Here's the full error:

zone.js:484 Unhandled Promise rejection: Template parse errors: 'md-content' is not a known element:

  1. If 'md-content' is an Angular component, then verify that it is part of this module.
  2. If 'md-content' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message. ("class.md-sidenav-shown]="_isShowingBackdrop()">
[ERROR ->]<md-content [ngStyle]="_getStyles()"> "): MdSidenavLayout@0:165 ; Zone: ; Task: Promise.then ; Value: Error: Template parse errors:(…) Error: Template parse errors: 'md-content' is not a known element:
  • If 'md-content' is an Angular component, then verify that it is part of this module.
  • If 'md-content' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message. ("class.md-sidenav-shown]="_isShowingBackdrop()">
  • [ERROR ->]<md-content [ngStyle]="_getStyles()"> "): MdSidenavLayout@0:165 at TemplateParser.parse (webpack:///./~/@angular/compiler/src/template_parser/template_parser.js?:128:19) at RuntimeCompiler._compileTemplate (webpack:///./~/@angular/compiler/src/runtime_compiler.js?:244:51) at eval (webpack:///./~/@angular/compiler/src/runtime_compiler.js?:167:83) at Set.forEach (native) at compile (webpack:///./~/@angular/compiler/src/runtime_compiler.js?:167:47) at ZoneDelegate.invoke (webpack:///./~/zone.js/dist/zone.js?:332:29) at Zone.run (webpack:///./~/zone.js/dist/zone.js?:225:44) at eval (webpack:///./~/zone.js/dist/zone.js?:591:58) at ZoneDelegate.invokeTask (webpack:///./~/zone.js/dist/zone.js?:365:38) at Zone.runTask (webpack:///./~/zone.js/dist/zone.js?:265:48)

    qdouble avatar Aug 31 '16 07:08 qdouble

    You should do exactly what is said in error message: import CUSTOM_ELEMENTS_SCHEMA in the main module (I assume that you use material elements all over your app) and add schema: [CUSTOM_ELEMENTS_SCHEMA] in ngModule metadata. According to Angular official documentation CUSTOM_ELEMENTS_SCHEMA "defines a schema that will allow any property on elements with a - in their name, which is the common rule for custom elements".

    mateuszwitkowski avatar Aug 31 '16 16:08 mateuszwitkowski

    @mateuszwitkowski that doesn't make any sense, you should only have to use that when using stuff like polymer. Any directives defined in angular shouldn't need custom element schema.

    qdouble avatar Aug 31 '16 19:08 qdouble

    Just checked alpha 7-10 and it works fine now. Closing.

    qdouble avatar Aug 31 '16 20:08 qdouble

    I am having this problem with 8-1.

    paceld avatar Sep 06 '16 22:09 paceld

    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.