If you want to generate your href
dynamically based on some condition then you can set your href
on ng-mousedown
event and after that you can perform any event like open link in new tab
, open link in new window
and click
.
HTML:
<a href="javascript:void(0)" ng-mousedown="openDetailView($event, userRole)">{{label}}</a>
JS :
$scope.openDetailView = function (event, userRole) {
if(userRole == 'admin') {
jQuery(event.target).attr('href', 'admin/view');
} else {
jQuery(event.target).attr('href', 'user/view');
}
};
<a ng-href"{{your dynamic url}}" ng-click="your function">
. Not only do you have to show the correct dropdown, but also have a correct href value to open in a new tab. – Moonlight