Fetch data from an API using Angular 2 HTTP module

InstructorMike Hartington

Share this video with your friends

Send Tweet

A typical app will interact with some sort of remote API at some point. We’ll creating a simple provider class to fetch data from the Random User API and populate our apps UI with this data.

The IonicModule in this lesson provides some default Angular modules for convenience. As of Ionic 2.x.x, those modules include Angular's BrowserModule, HttpModule, FormsModule, and ReactiveFormsModule

Jeff Richardson
~ 7 years ago

I seem to be stuck on this lesson. Http must be defined along with several other providers. Anyone else run into this and have a solution?

Gavin
~ 7 years ago

I seem to be stuck on this lesson. Http must be defined along with several other providers. Anyone else run into this and have a solution?

I had the same problem but found that I did need to import HttpModule in the app.modules.ts file. import { HttpModule } from '@angular/http';

And then added HttpModule to the imports below.

It all worked after I did that.