-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No provider for Overlay! StaticInjectorError(AppModule)[MatMenuTrigger -> Overlay]: #10820
Comments
Same error. It seems like one Material component now has a dependency to CDK OverlayModule. Would be a breaking change, but it's not documented in the changelog. Using RC12. |
@cyrilletuzi the menu module has always had a dependency on the @istiti are you able to reproduce the error in a Stackblitz? |
For me it's not the menu, I don't use this one. But I just upgraded from Material 5 to 6, without any change in my app, and no I have the same error, needing |
For me it's |
The autocomplete module has also had the |
Then there really is an issue: I have to manually add the |
After some tests, it appears it's only happen in v6 when the module where |
Breaking change to my code or i used it wrongly but was working well in v5 simply adding MatMenuModule in certain lazymodule yes 😞 |
This sounds like a tooling issue. @cyrilletuzi can you double-check that both Material and all other |
@crisbeto Yep, everything (Angular / Material / CLI) is in v6 very last RC, and issue reproduced from scratch. |
I've the same issue with the MatMenuTrigger. |
I also fixed it by importing import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { OverlayModule } from "@angular/cdk/overlay";
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent,
],
imports: [
BrowserModule,
BrowserAnimationsModule,
OverlayModule,
AppRoutingModule,
],
providers: [],
bootstrap: [
AppComponent,
],
})
export class AppModule { } |
Btw, this happened to me in a brand new project generated yesterday with all
|
when i import the overlay module in a lazy loading module it also dosen't work. and jsut import the import { OverlayModule } from '@angular/cdk/overlay';
@NgModule({
imports: [OverlayModule]
})
export class NoLazyLoadingModule { } |
Today I updated to angular 6 have the same issue, ERROR Error: StaticInjectorError(WzzModule)[MatMenuTrigger -> Overlay]: |
@yokots |
when I add |
@yushihui The OVERLAY_PROVIDERS was deprecated. Just use OverlayModule. |
What's happening is quite strange: modules using The fact that when lazy-loading a module with |
Having similar issue due to [matTooltip].
Hope it helps |
What about if importing OverlayModule at the app.module.ts isn't an option? I am shipping a component as a library that uses material. Importing OverlayModule at the library.module does not resolve the issue, only if I import it at the app.module of the project that uses my library... this would require the user to perform additional setup instead of just being able to import my library and use it right away, Is there anyway around this?
|
…loaded modules Fixes injection errors being thrown by the overlay-based providers that have injection tokens for the default scroll strategy. The error comes from the fact that the scroll strategies were being provided at the root, whereas the `Overlay` provider was provided normally, causing it to be missing when a module is lazy-loaded. Fixes angular#10820.
…loaded modules Fixes injection errors being thrown by the overlay-based providers that have injection tokens for the default scroll strategy. The error comes from the fact that the scroll strategies were being provided at the root, whereas the `Overlay` provider was provided normally, causing it to be missing when a module is lazy-loaded. Fixes angular#10820.
…loaded modules Fixes injection errors being thrown by the overlay-based providers that have injection tokens for the default scroll strategy. The error comes from the fact that the scroll strategies were being provided at the root, whereas the `Overlay` provider was provided normally, causing it to be missing when a module is lazy-loaded. Fixes angular#10820.
I am facing the same problem with matToolTip -->
Im getting the error since I updated angular from v5 to v6 |
Yes this is also breaking for me after updating to v6. ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[MatTooltip -> Overlay]: |
For everyone having problems with the It's a temporary fix until they update the code... |
@renatop7 I too saw that referenced in another issue however that doesn't work for me inside a library, importing it inside the project's module or app module results in the same error. |
@Tyler-V Yeah, it seems another problem. |
@renatop7 you have right! The only way to get that thing working is to import |
…loaded modules Fixes injection errors being thrown by the overlay-based providers that have injection tokens for the default scroll strategy. The error comes from the fact that the scroll strategies were being provided at the root, whereas the `Overlay` provider was provided normally, causing it to be missing when a module is lazy-loaded. Fixes angular#10820.
…loaded modules Fixes injection errors being thrown by the overlay-based providers that have injection tokens for the default scroll strategy. The error comes from the fact that the scroll strategies were being provided at the root, whereas the `Overlay` provider was provided normally, causing it to be missing when a module is lazy-loaded. Fixes angular#10820.
…loaded modules Fixes injection errors being thrown by the overlay-based providers that have injection tokens for the default scroll strategy. The error comes from the fact that the scroll strategies were being provided at the root, whereas the `Overlay` provider was provided normally, causing it to be missing when a module is lazy-loaded. Fixes angular#10820.
…loaded modules (#11213) Fixes injection errors being thrown by the overlay-based providers that have injection tokens for the default scroll strategy. The error comes from the fact that the scroll strategies were being provided at the root, whereas the `Overlay` provider was provided normally, causing it to be missing when a module is lazy-loaded. Fixes #10820.
Same problem with v6 and Material Datepicker. |
@jelbourn It would be nice when regressions are found if there was a milestone/timeline created to provide insight on when merged issues would be released. |
@yushihui @matheusdavidson I do this . but it doesn't work |
Hi, I had the same problem. Turned out it was caused by importing I ended up importing only
This was sufficient for my needs and the error went away. |
The quickfix does not work for a NgModule created with the TestBed..
Error: StaticInjectorError(DynamicTestModule)[MatDialog -> Overlay]: |
Just wanna check if the issue fixed in the latest version |
i am still getting this error, although i have added OverlayModule in the AppModule. |
Hello, Although I am late to the post, I am facing the same issue. I have created a showcase project for a library I'm coding. When using a custom overlay service that I wrote, I faced the error. Simply providing my service into the module, instead of using I'm posting that just in case someone encounters the same issue in the same case. Sorry I bothered you all ! |
This worked for me! |
If you use ng-zorro-antd, you can try it with the following versions:
|
Hello, Im also facing this error, and I dont know how to fix it.. [Error] ERROR – Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[LoginComponent -> MatSnackBar]: |
Same problem after updating to Angular 8. |
Same problem. Angular 7.2. |
import { Overlay } from '@angular/cdk/overlay' in the spec file |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
bug
What are the steps to reproduce?
I update from angular 5.x and cli 1.7.x and rxjs 5.x to v6rc.x
I only update in my module this
MatMenuModule
and use it like:Before
It was working before update.
Current
The text was updated successfully, but these errors were encountered: