I want to open a link in new tab in angular, but as it is a SPA, if I open any link in new tab (right click > open link in new tab) then the site is opened in a new tab (www.domain.com) but not with the specific route (www.domain.com/some_route).
The link which I want to open in new tab gets the route from the controller using $location.path
in ng-click
. I cannot use href attribute in the .
Example HTML:
<a ng-click="myCustomPath()">Click Me</a>
Example JS (controller):
$scope.myCustomPath = function(id, slug){
$location.path('/some_route/id/slug');
}
I don't want to open the link in new using controller or any other js logic. No redirection, no $window.open or anything.
Long story short, I want to open "www.domain.com/some_route/id/slug" just by right clicking on the link.