Link inside an ion-item not working



I have a link inside an ion-item and I don’t know why it’s not working.

Here is my code:

<ion-item text-wrap no-lines>
<h2 [innerHTML]="myText | linker"></h2>

Linker is a Pipe that detects a link in myText and generates the real html link.

Any help, please?


Put it in the ion-item tag, and use this ui-sref.

Edit: didn’t notice that it’s Ionic 2!



I am using Ionic 2 :S


@Corin Do you know if it works in Angular 2? Using [innerHTML] like that looks suspicious to me, but maybe someone more knowledgeable will come along. I wouldn’t do it that way though. I’d use

<a href="{{expression}}">Text</a>


Yes @AaronSterling , [innerHTML] is part of Angular2 and its working for html elements, but my problem is that i need to bind links and this is not working for me :frowning:

And I can’t do using your way because is a chat app and we can have much more text and with more than one link :S


But anti-XSS sanitization is part of Angular 2 also and the security docs explicitly say they sanitize [innerHTML]. That doesn’t affect your use case?


Yes, you are totally right. I think so :frowning: