Solution 1 :

In this case that you are using innerHtml property binding you can place a html link in your description text with target=”_blank” to open the link in a new tab:

description =
    'some random text <a href="https://stackoverflow.com" target="_blank">https://stackoverflow.com/</a> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s';

Problem :

I have a span tag with inner html like this

In my html :

<span [innerHTML]="description"></span>

and in my ts:

description = "some random text  https://stackoverflow.com/ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s"

displaying it like this

It displays the link but when I click on that link it is opening in the same tab but I want it be opened in a new tab.

Is there any way to do this?

By

Leave a Reply

Your email address will not be published. Required fields are marked *