Cannot read property 'create' of undefined

Trying to work with the example mentioned here >

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.
  selector: 'page-welcome',
  templateUrl: 'welcome.html'
export class WelcomePage {

  constructor(public navCtrl: NavController) { }

  login() {

  signup() {

constructor(private alertCtrl: AlertController) { }

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


why do you have two constructor?

1 Like