linkifyjs
linkifyjs copied to clipboard
linkifyHtml events with ionic v1 / angular
Hello,
is there a way to add a click event on angular (ionic v1) ? Everything works perfect but an event in options for linkifyHtml needs jquery. Is there a way to add a onlick event on parsed url?
Thank you
I did some tricks for this purpose. Try adding the attribute "onclick" in the options. For example, in my case I wanted to open the link in the system browser. If I only set the target, the link still opens in the same webview of my app.
linkifyString(text, {
attributes: {
onclick: "window.open(this.href, '_system', 'location=yes'); event.preventDefault();"
},
target: '_system',
})
After that, it's possible that you will see the error WARNING: sanitizing HTML stripped some content. Then, this answer may help you.
*PS: I'm using Ionic v3/Angular 4, but I think this can be resolve in the same way.