Stay on current page when open new tab in angular

2019-08-09 18:11发布

问题:

<a class="seecode_button" href="#{{w.CouponID}}" ng-click="newwindow(w)" data-toggle="modal" data-target="#{{w.CouponID}}">CLICK Here</a>

$scope.newwindow = function(w) {
    $window.open(w.LandingPageURL, '_self');
    $window.open('#','_blank');
 };  

I am try to make when some one click on "CLICK Here" then need to open new window but need stay on current tab.

In my code current tab open in page its ok but popup also gone because of it refresh the page . I am using angular js 1.2.17 and for popup i am using bootstrap.js v3.0.0

回答1:

If you don't want to refresh the page, then use an empty href attribute.