Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

298
Vistas
Ionic 2 Project - Promise issue with authentication

I've been searching for a solution to this problem I'm having, but haven't found anything that works for my particular case. I am working on an Ionic 2 application and I am working on some authentication stuff for my login screen. The purpose of this file is to add backend functionality to the front end code I wrote (refer to my login.html file on the github link below). I was following the tutorial on this website: https://devdactic.com/login-ionic-2/

The problem I am having is that for certain functions, which will be marked in my code, I am getting a "Promise returned from (function) is ignored" which stops the code from functioning entirely. It doesn't come up as a compile error, but instead it is a runtime error that is:

Runtime Error Uncaught (in promise): Error: No provider for Http! Error at d

I am really not sure what this means, so any insight would be very helpful. If needed, I can provide a picture of the full error.

@IonicPage()
@Component({
  selector: 'page-login',
  templateUrl: 'login.html',
})
export class LoginPage {
  loading: Loading;
  registerCredentials = { email: '', password: ''};

  constructor(public navCtrl: NavController, private auth: AuthService, public navParams: NavParams,
  private alertCtrl: AlertController, private loadingCtrl: LoadingController) {}

  public createAccount() {
    this.navCtrl.push('RegisterPage'); //Promise ignored error
  }

  public login() {
    this.showLoading();
    this.auth.login(this.registerCredentials).subscribe(allowed => {
        if (allowed) {
          this.navCtrl.setRoot('HomePage'); //Promise ignored error
        } else {
          this.showError("Access Denied");
        }
      },
      error => {
        this.showError(error);
      });
  }

  showLoading() {
    this.loading = this.loadingCtrl.create({
      content: 'Please wait...',
      dismissOnPageChange: true
    });
    this.loading.present(); //Promise ignored error
  }

  showError(text) {
    this.loading.dismiss(); //Promise ignored error

    let alert = this.alertCtrl.create({
      title: 'Fail',
      subTitle: text,
      buttons: ['OK']
    });
    alert.present(prompt); //Promise ignored error
  }
}

Picture of the error: enter image description here

I am just not sure what is causing this problem, and it is causing my code to crash entirely and won't even load my UI. If you need to look at some of the other files, the rest is on my github, this particular file is located in /src/pages/login.

The rest of the files: https://github.com/jparr721/Badmeat/tree/master/BadMeat-Ionic/FirstBuild/src

  • IDE: JetBrains WebStorm
  • OS: MacOS Sierra
  • Ionic Version: 2.2.2
over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You probably figured it out already but try changing the public to private in your code over here:

constructor(public navCtrl: NavController,

try:

constructor(private navCtrl: NavController,
over 4 years ago · Santiago Trujillo Denunciar

0

I'm not sure if this will fix your problem but try adding the following to your app.module.ts file

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

it may fix your http provider error you will also have to add it to imports in the same file

imports: [
    BrowserModule,
    HttpModule,
    CloudModule.forRoot(cloudSettings),
    IonicModule.forRoot(MyApp),
    IonicStorageModule.forRoot()
  ],
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda