Cannot read property 'create' of undefined

Trying to work with the example mentioned here > https://ionicframework.com/docs/api/components/alert/AlertController/

and the code returns an error “Cannot read property ‘create’ of undefined”

My code is

import { Component } from '@angular/core';
import { IonicPage, NavController, AlertController } from 'ionic-angular';

/**
 * The Welcome Page is a splash page that quickly describes the app,
 * and then directs the user to create an account or log in.
 * If you'd like to immediately put the user onto a login/signup page,
 * we recommend not using the Welcome page.
*/
@IonicPage()
@Component({
  selector: 'page-welcome',
  templateUrl: 'welcome.html'
})
export class WelcomePage {

  constructor(public navCtrl: NavController) { }

  login() {
    this.navCtrl.push('LoginPage');
  }

  signup() {
  	this.presentAlert()
    this.navCtrl.push('SignupPage');
  }

constructor(private alertCtrl: AlertController) { }

presentAlert() {
  let alert = this.alertCtrl.create({
    title: 'Low battery',
    subTitle: '10% of battery remaining',
    buttons: ['Dismiss']
  });
  alert.present();
}


}

why do you have two constructor?

1 Like