How to allow 'Open in a new tab' when using ng-click?

Issue

I have a table on HTML and each row leads to a different page, with more details about that row. But as I am using angularjs, with ng-click I can’t right click this row and select ‘open in a new tab’. Is there any way to solve it?

Thanks in advance!

Solution

If possible you should convert your element to an anchor element.

<a ng-href="{{ your dynamic url }}" ng-click="your function">Your link text</a>

The browser will interpret the element as a link, and will therefor give you the correct dropdown.
Note that you also have to have the correct href value to open in a new tab.

EDIT:
I would recommend this question if you want a more detailed answer on how to fix this kind of behaviour using JQuery.

Answered By – Erex

Answer Checked By – Katrina (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.