Runtime Error Uncaught (in promise): Error: StaticInjectorError[HTTP]: StaticInjectorError[HTTP]: NullInjectorError: No provider for HTTP!

Runtime Error
Uncaught (in promise): Error: StaticInjectorError[HTTP]: StaticInjectorError[HTTP]: NullInjectorError: No provider for HTTP! Error: StaticInjectorError[HTTP]: StaticInjectorError[HTTP]: NullInjectorError: No provider for HTTP! at NullInjector.get (http://localhost:8100/build/vendor.js:1276:19) at resolveToken (http://localhost:8100/build/vendor.js:1564:24) at tryResolveToken (http://localhost:8100/build/vendor.js:1506:16) at StaticInjector.get (http://localhost:8100/build/vendor.js:1377:20) at resolveToken (http://localhost:8100/build/vendor.js:1564:24) at tryResolveToken (http://localhost:8100/build/vendor.js:1506:16) at StaticInjector.get (http://localhost:8100/build/vendor.js:1377:20) at resolveNgModuleDep (http://localhost:8100/build/vendor.js:10938:25) at NgModuleRef.get (http://localhost:8100/build/vendor.js:12159:16) at resolveDep (http://localhost:8100/build/vendor.js:12655:45)
Stack
Error: Uncaught (in promise): Error: StaticInjectorError[HTTP]:
StaticInjectorError[HTTP]:
NullInjectorError: No provider for HTTP!
Error: StaticInjectorError[HTTP]:
StaticInjectorError[HTTP]:
NullInjectorError: No provider for HTTP!
at NullInjector.get (http://localhost:8100/build/vendor.js:1276:19)
at resolveToken (http://localhost:8100/build/vendor.js:1564:24)
at tryResolveToken (http://localhost:8100/build/vendor.js:1506:16)
at StaticInjector.get (http://localhost:8100/build/vendor.js:1377:20)
at resolveToken (http://localhost:8100/build/vendor.js:1564:24)
at tryResolveToken (http://localhost:8100/build/vendor.js:1506:16)
at StaticInjector.get (http://localhost:8100/build/vendor.js:1377:20)
at resolveNgModuleDep (http://localhost:8100/build/vendor.js:10938:25)
at NgModuleRef
.get (http://localhost:8100/build/vendor.js:12159:16)
at resolveDep (http://localhost:8100/build/vendor.js:12655:45)
at c (http://localhost:8100/build/polyfills.js:3:19752)
at Object.reject (http://localhost:8100/build/polyfills.js:3:19174)
at NavControllerBase._fireError (http://localhost:8100/build/vendor.js:48484:16)
at NavControllerBase._failed (http://localhost:8100/build/vendor.js:48477:14)
at http://localhost:8100/build/vendor.js:48524:59
at t.invoke (http://localhost:8100/build/polyfills.js:3:14976)
at Object.onInvoke (http://localhost:8100/build/vendor.js:4982:33)
at t.invoke (http://localhost:8100/build/polyfills.js:3:14916)
at r.run (http://localhost:8100/build/polyfills.js:3:10143)
at http://localhost:8100/build/polyfills.js:3:20242

1 Like

add this in app.module

import { HTTP } from '@ionic-native/http';

imports: [
    BrowserModule,
    IonicModule.forRoot(MyApp),
   HTTP
  ],
1 Like

Thanks!
But I done it and it didn’t work,
They told me to to used HTTPModule also, it’s the same

Hi, I faced this issue and fix it with importing both of:
import { Http } from '@angular/http’
import { HttpClientModule } from ‘@angular/common/http’;

Don’t forget to add HttpClientModule to the app.module providers also

1 Like

Hey guys, i have seen the above suggestions but i keep on getting this error:

“Unexpected value ‘HTTP’ imported by module ‘AppModule’ . Please add a @NgModule annotation”.

How can i solve this, kindly assist.

In app.module.ts

  1. Add import { HTTP } from ‘@ionic-native/http’;
  2. Add HTTP into providers: [ … HTTP …];

It worked for me (:

2 Likes

Another right way:
import { HttpModule } from ‘@angular/http’; on app.module.ts
import { Http } from ‘@angular/http’; on the page you’ll work on it with the constructor injection (public http: Http,) … so now you can manipulate with commands like this.http.get(…)

1 Like

@emadhidemo @vgonsalez @Francdev @dery

Hi guys, i have the same problem and tried all the above but non of them works. Please suggest me any other way i am facing this issue for the last two weeks but couldn’t solve yet.

So the get like that: this.http.get(url).map(res => res.json()).subscribe(data=>{ … })

1 Like

I Worte it as a steps hereunder, :grinning:

i should write my file name in firebase instead of res.json??? @emadhidemo

1 Like

Runtime Error
Uncaught (in promise): ReferenceError: res is not defined ReferenceError: res is not defined at new HomePage (http://localhost:8100/build/main.js:65:29) at createClass (http://localhost:8100/build/vendor.js:12859:20) at createDirectiveInstance (http://localhost:8100/build/vendor.js:12700:37) at createViewNodes (http://localhost:8100/build/vendor.js:14158:53) at createRootView (http://localhost:8100/build/vendor.js:14047:5) at callWithDebugContext (http://localhost:8100/build/vendor.js:15472:42) at Object.debugCreateRootView [as createRootView] (http://localhost:8100/build/vendor.js:14755:12) at ComponentFactory_.create (http://localhost:8100/build/vendor.js:11652:46) at ComponentFactoryBoundToModule.create (http://localhost:8100/build/vendor.js:4404:29) at NavControllerBase._viewInit (http://localhost:8100/build/vendor.js:51720:44)

this is the error i have in

What you need to do exactly Mohamed :thinking: maybe I can help, the page error code of the http import, firebase is different, the run time error you sent now “res”!?

@emadhidemo thank you so much. the problem solved

1 Like

mohammad77 could be a good practice to post how you solve the problem, don’t you think so?

I forgot put httpClientModule in the providers part . This i show i solved @rpicilli

Thank you Mohammad77 by your attention in reply.

1 Like

Worked, thank you very much.

Just a note if somebody fell here: you may not need both @angular/http and @angular/common/http, this package was renamed and updated by the Angular team. The newest version is the HttpClient (common/http). You’ll also have to import HttpClientModule (or the old HttpModule according to what you’re using).

1 Like