title: Angular 4/5 Uncaught Error: Template parse errors: Can't bind to 'mat-dialog-close' since it isn't a known property of 'button'
body: <p>this has happened when I tried to follow the dialog tutorial from
   <a href="https://material.angular.io/components/dialog/overview" rel="noreferrer">https://material.angular.io/components/dialog/overview</a>
  and I'm getting the error above so if anyone has an idea of what I should do to 
  solve this problem?</p>
  
  <p>here is my code :
  the html for the modal</p>
  
  <pre><code>&lt;h1 mat-dialog-title&gt;Warning&lt;/h1&gt;
  
  &lt;div mat-dialog-content&gt;
    &lt;p&gt;Are you sure you want to delete the book {{data.title}} ?&lt;/p&gt;
  
  &lt;/div&gt;
  &lt;div mat-dialog-actions&gt;
    &lt;button mat-button [mat-dialog-close]="data.title" tabindex="2"&gt;Ok&lt;/button&gt;
    &lt;button mat-button (click)="onNoClick()" tabindex="-1"&gt;No Thanks&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>the class that active the modal:</p>
  
  <pre><code>import { Component, OnInit, Inject } from '@angular/core';
  import { MatDialogRef, MAT_DIALOG_DATA} from '@angular/material';
  @Component({
    selector: 'app-remove-book',
    templateUrl: './remove-book.component.html',
    styleUrls: ['./remove-book.component.scss']
  })
  export class RemoveBookComponent implements OnInit {
  
  
    constructor(
      public dialogRef: MatDialogRef&lt;RemoveBookComponent&gt;,
      @Inject(MAT_DIALOG_DATA) public data: any) { }
  
    onNoClick(): void {
      this.dialogRef.close();  
    }
  
  
    ngOnInit() {
    }
  
  }
  
  and the method in the class that supposes to active the modal:
    removeContact(i){ 
  
  
      let dialogRef = this.dialog.open(RemoveBookComponent, {
        width: '250px',
        data: { ok: this.ok, title: this.contactsArr[i].title }
      });
  
      dialogRef.afterClosed().subscribe(result =&gt; { 
  
        console.log('The dialog was closed');
  
          this.contactsArr.splice(i,1);
  
  
      });
  
  
        }
  </code></pre>
  
  <p>I did all the required imports and it should work if someone can help I would appreciate it very much. </p>
  
  <p>thanks. </p>