I reoponed this issue since it didn't solve my problem in a similar discusion.
I still have the error 'No provider for MdDialogRef' even after i followed the official tutorial step by step.
I have two components. First component :
import { MdDialog} from "@angular/material";
import { DocumentDialogComponent } from './document-dialog.component';
@Component({
selector: 'documents-list',
template
})
export class DocumentsListComponent {
constructor(
public dialog: MdDialog) {
}
openFormDialog() {
let dialogRef = this.dialog.open(DocumentDialogComponent,
{
}
);
dialogRef.afterClosed().subscribe(result => {
this.selectedOption = result;
});
}
My second component (The Dialog) :
import { MdDialogRef} from "@angular/material";
@Component({
selector: 'document-dialog',
template
})
export class DocumentDialogComponent {
constructor(
public dialogRef: MdDialogRef<DocumentDialogComponent>
) {}
}
And my module config :
import { MaterialModule } from "@angular/material";
import { DocumentsListComponent } from './documents-list.component';
import { DocumentDialogComponent } from './document-dialog.component';
imports : [
MaterialModule.forRoot()
],
declarations: [
AppComponent,
DocumentListComponent,
DocumentDialogComponent
],
entryComponents: [
AppComponent,
DocumentListComponent,
DocumentDialogComponent
],
providers: [
],
bootstrap: [
AppComponent
]
Why i still have the error :
Error in ./DocumentsListComponent class DocumentsListComponent - inline template:0:167 caused by: No provider for MdDialogRef!