-
Notifications
You must be signed in to change notification settings - Fork 24.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
ERROR Error: Uncaught (in promise): Error: StaticInjectorError[e]: #20339
Comments
Importing both HttpModule and HttpClientModule fixes the problem.
|
@ocombe is working on a fix (better error message) |
Add import { HttpModule } from '@angular/http'; in app.module.ts |
still not working for me |
also not working for me , same error |
same here |
Not working for me |
in app module Maybe you need to add in the service |
Have the same issue :( |
same issue here (ive imported the httpmodule, but still not working) |
Same error , Not working for me too |
Worked by importing |
Have to add app.module.ts under provider section to make them available in providers Problem fixed!! HUHU |
@jersonjohn - Which service to registere in Providers section. I am facing the same issue and after reading above suggestions, I have already imported HttpClient and HttpClientModule in my app.module.ts (even though I am not using them)... Please advise. Thanks |
providers: [ |
@ilivestrong all services need to configure in the providers section of the app.module.ts Something like this providers: [ |
@jersonjohn - I already have all my custom services and angular services in providers array. Not sure why it's not working. I am just trying to build a login page using a reactive form (using FormBuilder). Not sure what is breaking it... |
@ilivestrong have you included |
@mumairofficial - Yes I did. Strangely I created a new project and it went away, only until I wrote a new route guard and I get this StaticInjectionError for my route guard now. This route guard is provided as well. :( |
I had the same problem after creating a new service using ng-cli. This should automatically add the service to the providers array in app.module.ts |
I had same issue but after importing "HttpModule" in "app.module.ts" it worked fine for me.
Thanks. |
Add import { HttpModule } from '@angular/http'; in app.module.ts for Http |
I imported both HttpModule and HttpClientModule but still getting the same error , Please any one help me out , i am trying to implement routing . |
@amitkprajapati import HttpClientModule in
|
however someone answered correctly but i refer to correct solution too .... 2 - otherwise use 'HttpModule' and 'Http' from '@angular/http': |
@MehdiZohrevnd what should be version 6 ? |
I am having the same issue , even when I do the HttpClientModule imports :/ plz help |
Hi , i solved this way , in angular 6 httpModule is deprecated and was removed from Angular. this is my app.module.ts
and then add into imports:
in my service
and this works for me cheers! |
As was mentioned above, this worked for me: |
Using Angular 6 and tried every suggestion... the problem continues... pls suggest |
In my case I had multiple resolvers and was using the wrong syntax by putting a [] around the resolvers eg [{name1:resolver1{,{name2:resolver2}] . Instead the syntax should be {name1:resolver1,name2:resolver2} |
Instead of doing this [{name1:resolver1*{*,{name2:resolver2}]
Please try this one [{name1:resolver1*}*,{name2:resolver2}]
|
this worked for me @Injectable({ |
Just in case someone needs additional info, especially if it's about erros with
So this is what helped me: I added to my xyz.component.
and
In fact,
Notes:
|
One of the ways I was able to solve this issue is: Add "HttpClientModule" existing in '@angular/common/http' inside app.module.ts file and add "HttpCleint" existing in '@angular/common/http' inside the component/service typescript file wherein you are sending Http requests. |
In the auth.guard.ts
|
I solved imports: [ for mi |
Problem fixed ! |
if we are using {Http ,Headers, or anything } from '@angular/http'; in app.compontent.ts file or app.service.ts file or any otherfile.ts then we have to add HttpModule in app.module.ts before using these in service.ts file or component.ts file |
angular-cli version is too high, Problem fixed |
how did you fix it |
Reduce the @angular/cli version to 6.2.8 |
the correct amount is { Http } from '@angular/http'; in Providers |
I'm using ionic version 3 and the following solution worked for me: Inside app_module.ts add: Then add that to your imports array, like so: Thanks to #20339 (comment) |
I ended up importing HttpClientModule and the auth-guard file into app.module.ts, supplied the auth guard dependency in the providers array, and the HttpClientModule into the imports array.
note: I did not need to downgrade @angular/cli |
Thanks . I had same issue but it got fixed |
I have same issue but it is not fixed. app.module.ts imports: [ package.json "devDependencies": { |
This work for me: in @NgModule import HttpModule and works! |
For me helped: |
Remember that Pipes also needs to be in the providers' array. I got the error when I had my Pipes in a shared module, exporting them, but forgot to add them as providers. |
The solution is simple that you might be missing services under providers array. When you run in devlopment mode you will be able exactly identify the missing service under providers array. When you run in production mode the error log doesn't show the exact missing service/s under providers. |
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. |
https://image.prntscr.com/image/4Huq_HhQTHyIjYKH0ztgKw.png
ERROR Error: Uncaught (in promise): Error: StaticInjectorError[e]: StaticInjectorError[e]: NullInjectorError: No provider for e!
The text was updated successfully, but these errors were encountered: