# Alertcontroller Not Working

**URL:** <https://forum.ionicframework.com/t/alertcontroller-not-working/115190>\
**Category:** ionic-v3\
**Created:** [December 13, 2017, 12:01am UTC](https://forum.ionicframework.com/t/alertcontroller-not-working/115190 "2017-12-13T00:01:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![praharsh0](https://avatars.discourse-cdn.com/v4/letter/p/f0a364/32.png) [@praharsh0](https://forum.ionicframework.com/u/praharsh0)\
**Post date:** [December 13, 2017, 12:01am UTC](https://forum.ionicframework.com/t/alertcontroller-not-working/115190/1 "2017-12-13T00:01:17Z")

</div>

Hello,

I am new to ionic. I barely know basics about html & css. I have not a single clue about javascript. However, I am determined to develop a small project in the form of an app for my church. I have no support, but I have been wandering around and searching on the web to make this impossible task happen. Therefore, I need your help in helping me built this app.

I am watching a video and trying to replicate the same commands for a desired output. I am not able to get it. I am using Ionic 3.19.0

import { Component } from ‘@angular/core’;

import { NavController } from ‘ionic-angular’;

import { AlertController } from ‘ionic-angular’;

@Component({  
selector: ‘page-home’,  
templateUrl: ‘home.html’  
})  
export class HomePage {

constructor(public navCtrl: NavController, private alertCtrl: AlertController) {

}

```
openTodoAlert(){
  let addTodoAlert = this.alertCtrl.create({
    title: "Add a Todo",
    message: "Enter your Todo",
    inputs: [
        {
          type: "text",
          name: "addTodoInput"      
        }
      ],
      buttons: [
        {
          text: "cancel"
        },
        {
          text: "Add Todo"
        }
      ]
  });
  
   addTodoAlert.present();

```

}  
}

For some strange reason, the alertcontroller is not working.

Could anyone please help me?

---

<div class="post-metadata">

**Author:** ![jaydz](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@jaydz](https://forum.ionicframework.com/u/jaydz)\
**Post date:** [December 13, 2017, 12:11am UTC](https://forum.ionicframework.com/t/alertcontroller-not-working/115190/2 "2017-12-13T00:11:00Z")

</div>

What’s not working. The alert controller is not presenting?  
if that’s the case, I would guess it is something in your html. Your code should be showing the alert controller. Are you sure your html is set up properly?

```auto
(click)="openTodoAlert()">

```

Perhaps you forgot the `()`?

---

<div class="post-metadata">

**Author:** ![praharsh0](https://avatars.discourse-cdn.com/v4/letter/p/f0a364/32.png) [@praharsh0](https://forum.ionicframework.com/u/praharsh0)\
**Post date:** [December 13, 2017, 9:42pm UTC](https://forum.ionicframework.com/t/alertcontroller-not-working/115190/4 "2017-12-13T21:42:02Z")

</div>

\<button ion-button (Click)=“OpenTodoAlert()”\>

“Click” was added in the correct format in html

---

<div class="post-metadata">

**Author:** ![jaydz](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@jaydz](https://forum.ionicframework.com/u/jaydz)\
**Post date:** [December 13, 2017, 11:10pm UTC](https://forum.ionicframework.com/t/alertcontroller-not-working/115190/5 "2017-12-13T23:10:06Z")

</div>

Is openTodoAlert() capitalized / not capitalized in both pages?

---

<div class="post-metadata">

**Author:** ![jaydz](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@jaydz](https://forum.ionicframework.com/u/jaydz)\
**Post date:** [December 13, 2017, 11:11pm UTC](https://forum.ionicframework.com/t/alertcontroller-not-working/115190/6 "2017-12-13T23:11:02Z")

</div>

And

```auto
(click)

```

don’t capitalize it

---

<div class="post-metadata">

**Author:** ![praharsh0](https://avatars.discourse-cdn.com/v4/letter/p/f0a364/32.png) [@praharsh0](https://forum.ionicframework.com/u/praharsh0)\
**Post date:** [December 13, 2017, 11:16pm UTC](https://forum.ionicframework.com/t/alertcontroller-not-working/115190/7 "2017-12-13T23:16:54Z")

</div>

wow, a rookie mistake  
C was capitalized  
it works now

Thank you very much

---

<div class="post-metadata">

**Author:** ![FrancoisIonic](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/francoisionic/32/106767_2.png) [@FrancoisIonic](https://forum.ionicframework.com/u/FrancoisIonic)\
**Post date:** [December 14, 2017, 12:15am UTC](https://forum.ionicframework.com/t/alertcontroller-not-working/115190/8 "2017-12-14T00:15:14Z")

</div>

Yes sometimes ionic Typescript does matter, and is case sensitive, have fun with your project

---

<div class="post-metadata">

**Author:** ![gilbertlucas46](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/gilbertlucas46/32/121388_2.png) [@gilbertlucas46](https://forum.ionicframework.com/u/gilbertlucas46)\
**Post date:** [September 1, 2018, 5:29am UTC](https://forum.ionicframework.com/t/alertcontroller-not-working/115190/9 "2018-09-01T05:29:37Z")

</div>

I have the same issue, the case is correct but it turns out instead of putting the (click) event in the button I put it in the ion-icon

```auto
<button ion-button>
        <ion-icon name="add" (click)="openTodoAlert()"></ion-icon>
  </button>

```

it should be

```auto
<button ion-button (click)="openTodoAlert()">
        <ion-icon name="add"></ion-icon>
  </button>

```

---

<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:59pm UTC](https://forum.ionicframework.com/t/alertcontroller-not-working/115190/10 "2021-07-19T21:59:27Z")

</div>

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


