No provider for MdDialogRef
See original GitHub issueHi,
I keep having the error 'No provider for MdDialogRef’ even after i followed the tutorial for MdDialog.
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 ) {}
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! ?
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
"No provider for MdDialogRef!" - Stack Overflow
You may have tried to use your dialog component in a template like this: <pizza-dialog ...></pizza-dialog>. Delete that from your template and open...
Read more >Testing MdDialog component, getting an error - Google Groups
I am trying to test a component I made and I'm getting this error: Error: No provider for MdDialogRef! Here is my test...
Read more >providedIn: LazyModule fails with no provider error-angular.js
[Solved]-providedIn: LazyModule fails with no provider error-angular.js ... error when trying to test a component with dialog No provider for MdDialogRef ...
Read more >Dialog | Angular Material
A dialog is opened by calling the open method with a component to be loaded and an optional config object. The open method...
Read more >Angular Material Dialog: A Complete Example
Error: No component factory found for CourseDialogComponent. ... NullInjectorError: No provider for MatDialogRef!
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I found the problem ! When i use html code inside my the component template it Works !!
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.