I am posting this information here to as a reminder so next time you see this error you will know how to fix it.

the error i got in my ionic 2/ angular 2 typescript was this on the broswer:

Runtime Error
Uncaught (in promise): Error: No provider for Http! Error: No provider for Http! at injectionError (http://localhost:8101/build/main.js:1509:86) at noProviderError (http://localhost:8101/build/main.js:1547:12) at ReflectiveInjector_._throwOrNull (http://localhost:8101/build/main.js:3048:19) at ReflectiveInjector_._getByKeyDefault (http://localhost:8101/build/main.js:3087:25) at ReflectiveInjector_._getByKey (http://localhost:8101/build/main.js:3019:25) at ReflectiveInjector_.get (http://localhost:8101/build/main.js:2888:21) at AppModuleInjector.NgModuleInjector.get (http://localhost:8101/build/main.js:3835:52) at resolveDep (http://localhost:8101/build/main.js:11202:45) at createClass (http://localhost:8101/build/main.js:11060:35) at _createProviderInstance (http://localhost:8101/build/main.js:11030:26)

when i look in the console this is what it says:


core.es5.js:1084
ERROR Error: Uncaught (in promise): Error: No provider for Http! Error: No provider for Http! at injectionError (core.es5.js:1231) at noProviderError (core.es5.js:1269) at ReflectiveInjector_._throwOrNull (core.es5.js:2770) at ReflectiveInjector_._getByKeyDefault (core.es5.js:2809) at ReflectiveInjector_._getByKey (core.es5.js:2741) at ReflectiveInjector_.get (core.es5.js:2610) at AppModuleInjector.NgModuleInjector.get (core.es5.js:3557) at resolveDep (core.es5.js:10924) at createClass (core.es5.js:10782) at _createProviderInstance (core.es5.js:10752) at injectionError (core.es5.js:1231) at noProviderError (core.es5.js:1269) at ReflectiveInjector_._throwOrNull (core.es5.js:2770) at ReflectiveInjector_._getByKeyDefault (core.es5.js:2809) at ReflectiveInjector_._getByKey (core.es5.js:2741) at ReflectiveInjector_.get (core.es5.js:2610) at AppModuleInjector.NgModuleInjector.get (core.es5.js:3557) at resolveDep (core.es5.js:10924) at createClass (core.es5.js:10782) at _createProviderInstance (core.es5.js:10752) at c (polyfills.js:3) at Object.reject (polyfills.js:3) at NavControllerBase._fireError (nav-controller-base.js:322) at NavControllerBase._failed (nav-controller-base.js:310) at nav-controller-base.js:365 at t.invoke (polyfills.js:3) at Object.onInvoke (core.es5.js:4125) at t.invoke (polyfills.js:3) at r.run (polyfills.js:3) at polyfills.js:3

 

SOLUTION:

The solution is very simple, i found some help here:

https://forum.ionicframework.com/t/no-provider-for-http-error-in-ionic-2/85762

https://stackoverflow.com/questions/33721276/angular-2-no-provider-for-http

 

what you need to do is open app.module.ts and add the following:

import { HttpModule } from '@angular/http';

and

imports: [
  HttpModule
  ],

after I added these two lines in my code, it worked, i did not see the error anymore, this was when i was using navcontroller push:

this.navCtrl.push(HomePage,{'QuizId':this.todo.value.QuizId});

as of 5/5/2020 the new angular module is:

 

import { HttpClientModule }    from '@angular/common/http';
  imports: [
    BrowserModule
    IonicModule.forRoot(), 
    AppRoutingModule
    HttpClientModule
  ],