'md-dialog-content' is not a known element

8,823 views
Skip to first unread message

gom

unread,
Dec 20, 2016, 8:13:24 PM12/20/16
to angular-material2
I keep getting this error:

'md-dialog-content' is not a known element:
1. If 'md-dialog-content' is an Angular component, then verify that it is part of this module.
...

"@angular/material": "2.0.0-alpha.11-2"  is imported into my app.


export const APP_IMPORTS = [
  MaterialModule.forRoot(),
   ...
]

I have no problems using md-input in templates. 

Can anyone explain why this could be happening? 

Karol Mierzejewski

unread,
Dec 21, 2016, 10:09:11 AM12/21/16
to angular-material2
I have the same problem. Also md-dialog-actions do not work.
I don't know yet how to efficiently make plunker examples, but I can link you the repo I'm working on, and a commit that causes problems:

https://bitbucket.org/kmierzej/fragaria-webapp/commits/7e0b847297c8fb569e636f55baa4afddc1f9dbf6?at=master

Any idea why md-dialog does not work?

Olivier Leplus

unread,
Apr 27, 2017, 11:28:28 PM4/27/17
to angular-material2
md-dialog-content is a directive, not a component and so should be used as a directive:

<div md-dialog-content>
Mycontent
</div>

Hope this helps :)

Mihai Balaceanu

unread,
Jul 1, 2017, 9:52:01 AM7/1/17
to angular-material2
Opening this question since the docs here: https://material.angular.io/components/dialog/overview and the source here: https://github.com/angular/material2/blob/andrewseguin-patch-1/src/lib/dialog/dialog-content-directives.ts says that you should use md-dialog-actions and md-dialog-content as elements but it still gives me
'md-dialog-content' is not a known element:
'md-dialog-actions' is not a known element:
using 2.0.0-beta.7
and if I try to use them as attributes, the md-button doesn't work
the module is async and it imports MaterialModule, MdDialogModule
what is up with that? really getting frustrated here

Mihai Balaceanu

unread,
Jul 1, 2017, 10:18:40 AM7/1/17
to angular-material2
Oh, sorry but it was my bad, the async module was loaded by another async module, and the parent was declaring the dialog components, which didn't have the modules imported actually.
Reply all
Reply to author
Forward
0 new messages