I need a link that will call a $scope-function when clicked, which will then display another view. I also want the user to be able to right-click on the link and open it in a new window or bookmark it. Unfortunately, the current html code is not working as intended:
<a ng-click="OpenSubsite(singleitem.Id)" href="{{GetUrl(singleItem.Id)}}">{{singleItem.Title}}</a>
The controller has the following code:
$scope.OpenSubSite=function(id) {
$scope.LoadItem(id);
}
$scope.GetUrl=function(id) {
return "showitem.html#id="+id;
}
Both methods work fine individually, but not when combined. I want the "OpenSubSite()
" function to be called when clicking the URL, but when right-clicking ("open in new tab" or "add to favorites"), I want to use the value returned by "GetUrl()
".
Currently, the URL from GetUrl()
is always being opened, even on left mouse button click.
Is there a way to achieve this functionality?