Change href of <a> in [innerHTML] to ionic page redirect

Hi everyone!

So here’s my situation:
I’m receiving HTML content as a normal string via an API call and put it into my component via [innerHTML] in a div. The HTML string I receive has some < a > tags that go to the profile page. I want to view this profile page in the app itself, so I have to replace the href to a (click) or on-tap event. Problem is, that I can’t edit the string before injecting it due to the HTML sanitiser fearing XSS. I already tried doing it via an actionListener over ElementReference but the content is loaded into the Component after the constructor or ionViewDidLoad so it just returns null.

Does anyone have an idea how i can solve this issue? Thanks for your help :slight_smile:

did you find a solution to this?

Matter of interpretation whether or not you’d call it a solution, but my suggestion is to use something structured more simply (like a subset of JSON) as a transfer format, not HTML. innerHTML IMHO should never have existed, because it encourages people to blur the lines of demarcation between data modelling and presentation.