How to open new tab in browser by using $location, angular?

后端 未结 3 1668
不知归路
不知归路 2021-02-11 21:46

I have controller \'reportCtrl\' and HTML that represents 6 tables with data and only several rows I show at once.

app.js

v         


        
3条回答
  •  抹茶落季
    2021-02-11 22:33

    If you want to open angular page in a new tab on ctrl+click or in same tab, then try this :-

    HTML :

    My Link
    

    JS:

        var navigationUrl = function (event) {
                if (event.ctrlKey) {
                    window.open(url, '_blank'); // in new tab
                } else {
                    $location.path(url); // in same tab
                }
            };
    

提交回复
热议问题