Reputation: 306
Basically I have a table where if the user clicks on id it opens a link on new tab. So if user clicks on another id it should open on that earlier tab and not make another 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, this is completely 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 as it opens the link on new tab everytime. But how can i keep the same tab for just click ?
Upvotes: 0
Views: 96
Reputation: 3137
You can use "_Parent" instead of "_blank" for this.
if (event.ctrlKey) {
window.open('link' + item,"_Parent"); // in new tab
}
Hope it will help.
Upvotes: 0