Dont work HTTP module

To import the module, I used this guide:

https://forum.ionicframework.com/t/guide-how-to-update-to-ionic-3-x/87516

But still it does not work. The application is created on Ionic 3.

What is the problem?

app.modules.ts

import { HTTP } from ‘@ionic-native/http’;
import { HttpModule } from ‘@angular/http’;
import { HttpClientModule } from ‘@angular/common/http’;

import { NgModule, ErrorHandler } from ‘@angular/core’;
import { BrowserModule } from ‘@angular/platform-browser’;
import { IonicApp, IonicModule, IonicErrorHandler } from ‘ionic-angular’;
import { MyApp } from ‘./app.component’;
import { Page1Page } from ‘…/pages/page1/page1’;
import { Page2Page } from ‘…/pages/page2/page2’;
import { Page3Page } from ‘…/pages/page3/page3’;
import { Page4Page } from ‘…/pages/page4/page4’;
import { Page5Page } from ‘…/pages/page5/page5’;

import { StatusBar } from ‘@ionic-native/status-bar’;
import { SplashScreen } from ‘@ionic-native/splash-screen’;

@NgModule({
declarations: [
MyApp,
Page1Page,
Page2Page,
Page3Page,
Page4Page,
Page5Page
],
imports: [
BrowserModule,
HttpModule,
HttpClientModule,
IonicModule.forRoot(MyApp)

page5.ts

import { Component } from ‘@angular/core’;
import { NavController } from ‘ionic-angular’;
import { FormGroup, Validators, FormBuilder } from ‘@angular/forms’;

import { HTTP } from ‘@ionic-native/http’;
import { HttpModule } from ‘@angular/http’;
@Component({
selector: ‘page-page5’,
templateUrl: ‘page5.html’
})
export class Page5Page {

private baseURI : string = “https://sportcomp.000webhostapp.com/”;

constructor(public navCtrl : NavController,
public http : Http,
public NP : NavParams,
public fb : FormBuilder,
public toastCtrl : ToastController)

ionViewWillEnter()
{
this.load();
}

// Retrieve the JSON encoded data from the remote server
// Using Angular’s Http class and an Observable - then
// assign this to the items array for rendering to the HTML template
load()
{
this.http.get(‘https://sportcomp@files.000webhost.com/mobileapp/retrieve-data.php’)
}
}

index.html

Error on page5.ts (or Registration page)

Runtime Error
Cannot read property ‘get’ of undefined

And after starting the server, too, it gives an error, until I re-save any file.

Typescript Error
Constructor implementation is missing.
c:/Android/
constructor(public navCtrl : NavController,
public http : Http,

I’m going to bind the user registration and the input to the MySQL database.

Help me please.

Try:

import { Http } from ‘@ionic-native/http’;

Instead of:

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

Is’t not correct.
We get a new error.

Typescript Error
Module ‘“c:/Android/PulseNew/node_modules/@ionic-native/http/index”’ has no exported member ‘Http’.

I am sorry. Http is for the angular import: import { Http } from '@angular/http'; so that’s my fault.

But now I see you are using the ‘@ionic-native/http’ you should have your constructor use private http : HTTP instead of public http : Http

Edit: As you can see in the docs: https://ionicframework.com/docs/native/http/

It all the same does not solve a problem, even having made all under the instruction (Can that that with my code not so?

Switch to the new Angular HttpClient: https://angular.io/guide/http

1 Like

Like @LoLStats says, I would switch to the Angular Http to see if that works then. I have used that one without any issues.

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

All the same does not help … I simply can not understand in any way in what a problem.