# Add link in alert controller

**URL:** <https://forum.ionicframework.com/t/add-link-in-alert-controller/124640>\
**Category:** ionic-v3\
**Created:** [March 15, 2018, 2:06am UTC](https://forum.ionicframework.com/t/add-link-in-alert-controller/124640 "2018-03-15T02:06:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hiralbarot](https://avatars.discourse-cdn.com/v4/letter/h/b77776/32.png) [@hiralbarot](https://forum.ionicframework.com/u/hiralbarot)\
**Post date:** [March 15, 2018, 2:06am UTC](https://forum.ionicframework.com/t/add-link-in-alert-controller/124640/1 "2018-03-15T02:06:12Z")

</div>

Hi Folks,

I want to perform below action in ionic alert :

this.alertCtrl.create({  
title : “some title”,  
message :"\<a (click)=“callFunc()”\>Click me! ",  
buttons :[‘Close’]  
}).present().then(() =\> {  
});

callFunc(){  
console.log(“function called”);  
}

How can I achieve this?  
I tried this snippet but i am not able to call function on href click!

Thanks!

---

<div class="post-metadata">

**Author:** ![user5555](https://avatars.discourse-cdn.com/v4/letter/u/8e7dd6/32.png) [@user5555](https://forum.ionicframework.com/u/user5555)\
**Post date:** [March 15, 2018, 2:35am UTC](https://forum.ionicframework.com/t/add-link-in-alert-controller/124640/2 "2018-03-15T02:35:18Z")

</div>

Make your own modal and style it like the alert, that allows you to have links in it. It shouldn’t be to hard and when you have your own alert you can do everything with it that you ever wanted, links, a big icon or basically everything else that can fit in a modal.

---

<div class="post-metadata">

**Author:** ![hiralbarot](https://avatars.discourse-cdn.com/v4/letter/h/b77776/32.png) [@hiralbarot](https://forum.ionicframework.com/u/hiralbarot)\
**Post date:** [March 15, 2018, 2:36am UTC](https://forum.ionicframework.com/t/add-link-in-alert-controller/124640/3 "2018-03-15T02:36:53Z")

</div>

So I have to change my alert controller to modal ?

---

<div class="post-metadata">

**Author:** ![user5555](https://avatars.discourse-cdn.com/v4/letter/u/8e7dd6/32.png) [@user5555](https://forum.ionicframework.com/u/user5555)\
**Post date:** [March 15, 2018, 2:38am UTC](https://forum.ionicframework.com/t/add-link-in-alert-controller/124640/4 "2018-03-15T02:38:35Z")

</div>

> [@hiralbarot](#):
>
> message :"\<a (click)=“callFunc()”\>Click me! ",

And this code would normally/theoretically throw an error, because you need to use `'`when you already using `"` for the outside. Or escape the inside `"` with `\"`.

---

<div class="post-metadata">

**Author:** ![user5555](https://avatars.discourse-cdn.com/v4/letter/u/8e7dd6/32.png) [@user5555](https://forum.ionicframework.com/u/user5555)\
**Post date:** [March 15, 2018, 2:41am UTC](https://forum.ionicframework.com/t/add-link-in-alert-controller/124640/5 "2018-03-15T02:41:44Z")

</div>

> [@hiralbarot](#):
>
> So I have to change my alert controller to modal ?

Yes you basically write your own alert.  
They should be some information about that on this forum, your not the first one who wanted to use html in alerts.

---

<div class="post-metadata">

**Author:** ![hiralbarot](https://avatars.discourse-cdn.com/v4/letter/h/b77776/32.png) [@hiralbarot](https://forum.ionicframework.com/u/hiralbarot)\
**Post date:** [March 15, 2018, 2:44am UTC](https://forum.ionicframework.com/t/add-link-in-alert-controller/124640/6 "2018-03-15T02:44:39Z")

</div>

Thank you! Will try with this approach!

---

<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:45pm UTC](https://forum.ionicframework.com/t/add-link-in-alert-controller/124640/7 "2021-07-19T21:45:39Z")

</div>

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


