Clickable link within text from backend

Hi there,

I’m getting a text block from my backend, and trying to highlight URLs to open an in-app browser with a click event.

Ie. some text might say: “Here is a link:”.

I tried adding a new element dynamically, with a (click) event, and got that to work using, but it fails with AOT compilation.

Does anyone have ideas in how to trigger a (click) event on a certain piece of text that is received from the backend?


I know this is so late for a reply but I stumbled upon this scenario recently and this is what I did.

You can use [innerHtml] to render html contents

For your given example, try:

this.textBlock = "<p>Here is a link <a href=''></a></p>";

<p ion-text [innerHtml]="textBlock"></p>