Components: Can't bind to 'mat-dialog-close' since it isn't a known property of 'button'.

Created on 9 Dec 2017  路  5Comments  路  Source: angular/components

Bug, feature request, or proposal:

Hi, I'm trying to work with a tutorial about modal in angular 5 -> https://material.angular.io/components/dialog/overview
and it's not working it giving me the error
Can't bind to 'mat-dialog-close' since it isn't a known property of 'button'.

here is my HTML code:

Warning

Are you sure you want to delete the book {{data.title}} ?

thanks.

Most helpful comment

Did you import the MatDialogModule ? For example in your app.module.ts file

import {MatDialogModule} from '@angular/material';

...

@NgModule({
  declarations: [
    ...
  ],
  imports: [
    ...
    MatDialogModule,
  ],

All 5 comments

Did you import the MatDialogModule ? For example in your app.module.ts file

import {MatDialogModule} from '@angular/material';

...

@NgModule({
  declarations: [
    ...
  ],
  imports: [
    ...
    MatDialogModule,
  ],

WOW!!! that was the problem thank you very very much!! :)

I think you can close the issue as it is not Angular Material's fault ;).

If you're opening a dialog with dialog.open in one module and your control is defined in another you must add the Dialog module import to both modules.

This is very easy to forget, and the dialog will open - it's just that then all dialog directives (including mat-dialog-actions / mat-dialog-title and mat-dialog-content will not work).

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alanpurple picture alanpurple  路  3Comments

kara picture kara  路  3Comments

jelbourn picture jelbourn  路  3Comments

theunreal picture theunreal  路  3Comments

julianobrasil picture julianobrasil  路  3Comments