Http not working anymore ionic 4


#1

Hello, I’m starting to test ionic v4 and I am trying to get a request from a localhost from my computer (so I am not planning to use the http native).

In my app.module I added the import { AppRoutingModule } from './app-routing.module'; and HttpModule within the provider array.

But when I try to connect it to a service, this error comes up: ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[Http]: The thing is, that when I

Another weird thing is that import 'rxjs/add/operator/map'; is not working anymore.

I am calling the api like this:

import {Http} from '@angular/http';
(....)
constructor (private http: Http) {}
getItems () {
  return this.http.get ("http://localhost:8888/project/file.php", {})
    .subscribe (res => {
      console.log (res);
    });
}

Thanks for your time!


#2

Http: old and busted.
HttpClient: new hotness.