简体   繁体   English

使用 ng-href 打开短信应用

[英]Open sms app using ng-href

I'm trying to figure how I can open the SMS app using ng-href.我想弄清楚如何使用 ng-href 打开 SMS 应用程序。 When i use当我使用

href="sms:?body=text"

it opens up the SMS app on my mobile device.它会在我的移动设备上打开 SMS 应用程序。 But if I use但如果我使用

ng-href="sms:?body=text"

It doesn't open the SMS app on my device.它不会在我的设备上打开 SMS 应用程序。 I tried hovering on the hyperlink with my mouse and it shows me an text/message "unsafe:sms?body" You can see the image below for reference我尝试用鼠标将鼠标悬停在超链接上,它向我显示了一条文本/消息“不安全:短信?正文”您可以查看下图以供参考

在此处输入图片说明

If you have a reference to the ng-app object, which can typical be found near the beginning of the angular app code.如果您有对ng-app对象的引用,通常可以在 angular 应用程序代码的开头附近找到它。

you can use this code:您可以使用此代码:

yourapp.config( ['$compileProvider', function( $compileProvider ) {   
    $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|sms|chrome-extension):/);
    }
]);

Hope this helps!希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM