javascript open page in new tab and new links on that same tab -
basically have table if user clicks on id opens link on new tab. if user clicks on id should open on earlier tab , not make new tab
$scope.navigationurl = function (event,item) { if (event.ctrlkey) { window.open('link' + item,"_blank"); // in new tab } else { $location.path('link' + item); // in same tab , yeah, wrong } ;
<tbody> <tr ng-repeat="case in lastbuild"> <td colspan="1" ng-click="navigationurl($event,case.id)">{{case.id}}</td> <td colspan="1">{{case.timetaken}}</td> </tr> </tbody>
the ctrl+click works opens link on new tab everytime. how can keep same tab click ?
the window.open
method has parameters:
window.open(url,name,specs,replace)
if define name window, , use on javascript code, named window replaced content.
reference here.
Comments
Post a Comment