I have following HTML:
<a href="" ng-click='redirectToEntity("B-",obj.id")'>Click me and Process function and then redirect</a>
This code does process function and redirect to page which I am targeting, but this does not work for Open in new tab by right clicking . I've tried numerous solution but none worked for me. I need to execute redirectToEntity function only when clicked on "Open in New Tab".
In order to let the normal right-click menu work, the <a>
needs to be a regular anchor tag. So it can't be activated by ng-click
. If all that redirectToEntity()
does is generate a url and redirect from within the controller, maybe instead you should just generate the url and add it to the href like this <a href="{{linkGeneratedInController}}">
.
Alternatively, you can also use a directive to bind an action to the right click, as is shown here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.