Search code examples
ionic-frameworkionic-popup

Ionic 1: Link not working in popup content


I working with ionic pop-up where inside the popup content, I want a clickable link. The problem is that the link that I created is not working. Can't click them. My code is as follows:

var mypopup = $ionicPopup.show({
   template: '<a href="http://google.com">Google</a>',
   buttons: [{
       text: 'Ok'
   }]
})

Is there any way I can enable a user to click that link and go to Google?

Many thanks!


Solution

  • Add target="_blank" property inside anchor tag and it will work perfectly fine. It will launch browser.

    Your current code:

    template: '<a href="http://google.com">Google</a>',

    Change to:

    template: '<a href="http://google.com" target="_blank">Google</a>',
    

    Here is working codepen snippet:

    https://codepen.io/anon/pen/rvaONv?editors=1010