How to open a link in a new tab using Angular and JavaScript?

Spread the love

Sometimes, we want to open a link in a new tab using Angular and JavaScript.

In this article, we’ll look at how to open a link in a new tab using Angular and JavaScript.

How to open a link in a new tab using Angular and JavaScript?

To open a link in a new tab using Angular and JavaScript, we set the target attribute to _blank.

For instance, we write

<a href="https://www.example.com/" target="_blank">page link</a>

in our component template to add a link that opens https://www.example.com/ in a new tab.

Conclusion

To open a link in a new tab using Angular and JavaScript, we set the target attribute to _blank.

Leave a Reply

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