components icon indicating copy to clipboard operation
components copied to clipboard

Unhandled Promise rejection: Template parse errors:'md-toolbar' is not a known element

Open vkishorekumar80 opened this issue 9 years ago • 5 comments

Unhandled Promise rejection: Template parse errors:'md-toolbar' is not a known element:

What is the expected behavior?

Load the toolbar, toggle button, button and progressbar

What is the current behavior?

Unhandled Promise rejection: Template parse errors: 'md-toolbar' is not a known element:

  1. If 'md-toolbar' is an Angular component, then verify that it is part of this module. What are the steps to reproduce?

http://plnkr.co/edit/VkE5K7lXssLKbXH8VA8F?p=preview

Is there anything else we should know? My Project configuration

CoreModule (core.module.ts): can contain core modules like Preogressbar, DialogModule, ToastModule etc. Each core module have its own module file progressbar.module.ts, dialog.module.ts etc. In the app.module.ts I will refer only the core.module.ts.

vkishorekumar80 avatar Jan 10 '17 19:01 vkishorekumar80

The problem is that the MaterialModule is missing in your NgModule.

The root NgModule is located in the main.ts file and is responsible for bootstrapping the app.component.

devversion avatar Jan 10 '17 20:01 devversion

@DevVersion This is the modified version of the plnkr based on your discussion. Is it the correct way ? http://plnkr.co/edit/jH7F1MsU6YaX8XtpoLNx?p=preview

vkishorekumar80 avatar Jan 11 '17 10:01 vkishorekumar80

@vkishorekumar80 Yeah now it works. Just to summarize how your NgModules should use the MaterialModule in beta.1

  • The root NgModule (in main.ts) should use the MaterialModule.forRoot() syntax.
  • Child NgModule's (as in progressbar.module.ts) should use MaterialModule without the forRoot()

Also notice that in an upcoming release the forRoot will be unnecessary for all NgModule's.

devversion avatar Jan 11 '17 10:01 devversion

@DevVersion Thank you very much for the information.

vkishorekumar80 avatar Jan 11 '17 10:01 vkishorekumar80

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.