Launch local application url from AngularJS

时间:2016-10-20 19:24:20

标签: angularjs protocols

I have a local application url protocol: myapp:///

In the terminal, when I do open myapp:///, the application launches. As I understand, this command is a bit different from different OS. Also, if I go to a browser and type myapp:/// I also launch the application.

My question is: can I do this in AngularJS by making some kind of request?

1 个答案:

答案 0 :(得分:0)

我通过提供用户可以点击的链接解决了这个问题。但是,必须在app.js

中添加协议
app.config(['$compileProvider', function ($compileProvider) {
    $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|myapp):/);
}]);

此白名单myapp:/// - 否则AngularJS会在其前面添加unsafe