Bug?? Either that or Ive done something wrong
No error when loading
On app startup Im seeing:
StaticInjectorError(AppModule)[MatDialogTitle -> MatDialogRef]
Full error is:
core.js:12301 ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[MatDialogTitle -> MatDialogRef]:
StaticInjectorError(Platform: core)[MatDialogTitle -> MatDialogRef]:
NullInjectorError: No provider for MatDialogRef!
Error: StaticInjectorError(AppModule)[MatDialogTitle -> MatDialogRef]:
StaticInjectorError(Platform: core)[MatDialogTitle -> MatDialogRef]:
NullInjectorError: No provider for MatDialogRef!
at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:691)
at resolveToken (core.js:928)
at tryResolveToken (core.js:872)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:769)
at resolveToken (core.js:928)
at tryResolveToken (core.js:872)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:769)
at resolveNgModuleDep (core.js:17435)
at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:18124)
at resolveDep (core.js:18495)
at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:691)
at resolveToken (core.js:928)
at tryResolveToken (core.js:872)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:769)
at resolveToken (core.js:928)
at tryResolveToken (core.js:872)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:769)
at resolveNgModuleDep (core.js:17435)
at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:18124)
at resolveDep (core.js:18495)
at resolvePromise (zone.js:814)
at resolvePromise (zone.js:771)
at zone.js:873
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:13842)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
at drainMicroTaskQueue (zone.js:595)
at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:500)
at invokeTask (zone.js:1540)
Angular Material: 6.4.7 and 7.0
Angular 7.0.2
Windows 10
Typescript 3.0.3
Chrome
Everything was fine until I updated to Angular 6.4.7 (and whatever version of Material went with that). Tried v 7 and no difference.
Ive checked that Im refering to MatDialogModule everywhere but I dont fully understand what the issue is since the error message ios somewhat cryptic.
Can you share a reproduction?
Can you share a reproduction?
Well, not really sorry, as I dont know what's causing it. The error message is pretty clear about "No provider for MatDialogRef! " and I thought I new what that meant and how to fix it, but that is not the case here. As I said, all I did was upgrade. I guess I could try a downgrade.. sigh but unless I know the cause that wont help me fix it.
Im more confused about "StaticInjectorError(AppModule)[MatDialogTitle -> MatDialogRef]" . What does that mean? Does it mean it's failing to inject MatDialogTitle into MatDialogRef? Im not sure how I could do anything that would cause that to fail.
I tried the solutions offered here: https://stackoverflow.com/questions/52885991/staticinjectorerrorappmodulematdialogtitle-matdialogref/52975331#52975331 and here: https://github.com/angular/material2/issues/8419.
i.e., I added this to my MaterialModule:
providers: [
{ provide: MatDialogTitle, useValue: {} },
{ provide: MatDialogRef, useValue: {} },
{ provide: MAT_DIALOG_DATA, useValue: [] }
]
This removes the error message from the console, but now my application started up and show the content of a dialog as the home page.
Without a reproduction it's impossible for us to determine if this is a valid issue in the component itself. We recommend using something like StackOverflow or gitter for getting help debugging your application.
I was really just looking for an explanation of the problem, not a solution. Stackoverflow is next to useless for complex issues like this. The people here are usually the most informed and knowledgeable, and therefore the most overworked I guess.
i had the same issue...
turn out that i was using the same component (by mistake) in a template (display it directly as '
hope this stupid o f mine mistake will help someone...
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._
Most helpful comment
I was really just looking for an explanation of the problem, not a solution. Stackoverflow is next to useless for complex issues like this. The people here are usually the most informed and knowledgeable, and therefore the most overworked I guess.