# Cannot read property 'create' of undefined

**URL:** <https://forum.ionicframework.com/t/cannot-read-property-create-of-undefined/131034>\
**Category:** ionic-v3\
**Created:** [May 22, 2018, 8:48am UTC](https://forum.ionicframework.com/t/cannot-read-property-create-of-undefined/131034 "2018-05-22T08:48:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gilson94](https://avatars.discourse-cdn.com/v4/letter/g/c57346/32.png) [@gilson94](https://forum.ionicframework.com/u/gilson94)\
**Post date:** [May 22, 2018, 8:48am UTC](https://forum.ionicframework.com/t/cannot-read-property-create-of-undefined/131034/1 "2018-05-22T08:48:14Z")

</div>

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

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

My code is

```auto
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();
}

}

```

---

<div class="post-metadata">

**Author:** ![JEricaM](https://avatars.discourse-cdn.com/v4/letter/j/b77776/32.png) [@JEricaM](https://forum.ionicframework.com/u/JEricaM)\
**Post date:** [May 23, 2018, 4:13pm UTC](https://forum.ionicframework.com/t/cannot-read-property-create-of-undefined/131034/2 "2018-05-23T16:13:37Z")

</div>

> [@gilson94](#):
>
> public navCtrl: NavController

why do you have two constructor?

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:35pm UTC](https://forum.ionicframework.com/t/cannot-read-property-create-of-undefined/131034/3 "2021-07-19T21:35:01Z")

</div>

Closed on July 19, 2021, 9:35pm UTC


