无法使用angularjs路由到具有不同协议的url



我正在尝试打开一个应用程序客户端,我只使用angularjs作为前端开发了整个应用程序。它似乎劫持了路由并禁止这样做。

在旧的javascript中,我曾经能够进行

var wnd = window.open("dynamicsnav://arbitraryLinkDetails", "_blank");
wnd.close(); // this opens the protocol to start the application client 
// side and closes the extra browser window

以打开Nav应用程序客户端以及要打开的内容的详细信息来代替arbitryLinkDetails。

现在,当我在我的angular应用程序中这样做时,它会将localhost附加到url(实际上它是它附加的基本域),就像一样

"http://localhost/"dynamicsnav://arbitraryLinkDetails""

这不起作用。

我尝试过的

  1. 将"//"附加到url以突破angularjs路由,这将在%22的开头添加一个标签,并删除了:对于类似"%22dynamicsnav//arbitryLinkDetails"的协议
  2. 我已经尝试修改路由,以便

    var redirectFunction(){
    return theUrl; //this gets the full url of dynamicsnav://arbitraryLinkDetails
    }
    $routeProvider
    .when('/NavUrl', {redirectTo: redirectFunction}) 
    

    并再次将基本url附加到它。

这是我当前项目的一个要求,我根本无法像以前用angularjs那样找到打开它的方法。

我在另一个不使用angular的应用程序中验证了我正在测试的url。谢谢你的帮助!

AngularJS$routeProvider服务管理的路由将控制器与视图深度链接,这不是你的情况,你为什么不试试这个:

var redirectFunction(){
window.open("dynamicsnav://arbitraryLinkDetails", "_blank");
}
$routeProvider
.when('/NavUrl', {redirectTo: redirectFunction}) 

最新更新