Runtime Error - Followed the tutorial from youtube


#1

I followed a video tutorial on Loading Remote JSON Data with HTTP in Ionic 2 . But occured the following error and i would really appreciate some help .

Link to the video is provided :- https://www.youtube.com/watch?v=vuc4dp0qHSc

Runtime Error
Uncaught (in promise): Error: No provider for Http! Error: No provider for Http! at injectionError (http://localhost:8100/build/main.js:1509:86) at noProviderError (http://localhost:8100/build/main.js:1547:12) at ReflectiveInjector_.throwOrNull (http://localhost:8100/build/main.js:3048:19) at ReflectiveInjector.getByKeyDefault (http://localhost:8100/build/main.js:3087:25) at ReflectiveInjector.getByKey (http://localhost:8100/build/main.js:3019:25) at ReflectiveInjector.get (http://localhost:8100/build/main.js:2888:21) at AppModuleInjector.get (ng:///AppModule/module.ngfactory.js:219:98) at AppModuleInjector.getInternal (ng:///AppModule/module.ngfactory.js:328:50) at AppModuleInjector.NgModuleInjector.get (http://localhost:8100/build/main.js:3834:44) at resolveDep (http://localhost:8100/build/main.js:11202:45)


#2

I didn’t watch the video but error is clear. You must add HttpModule to your module. Go app.module and add HttpModule like this.

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

@NgModule({
  declarations: [
    ...
  ],
  imports: [
    HttpModule,
    ...
  ],
  bootstrap: [
    ...
  ],
  entryComponents: [
    ...
  ],
  providers: [
    ...
  ]
})
export class AppModule { }

#3

thank you @hmtylmz . That was the issue