AngularJS 中的 Whatsapp 共享 [英] Whatsapp Sharing in AngularJS
本文介绍了AngularJS 中的 Whatsapp 共享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
虽然应该很简单,但它无法工作,因为此代码无法检测 AngularJS 代码.
Simple as it should be, it won't work as this code can't detect AngularJS codes.
<a href="whatsapp://send?text={{challenge.challenge_title}}"
data-action="{{FullURL}}">Whatsapp</a>
我需要一个指令吗?如果是,那是什么?有 AngularJS 经验的人请帮忙.
Do i need a directive for this? If yes, what is it? Someone with experience in AngularJS, kindly help.
推荐答案
您需要在 angular 的 config
阶段清理锚点 href
,这将允许您的 href 与whatsapp
前缀.
You need to sanitize anchor href
inside your config
phase of angular, that will allow your href with whatsapp
prefix.
代码
app.config(function($compileProvider){
//other configuration code here
$compileProvider.aHrefSanitizationWhitelist(/^\s*(whatsapp):/);
})
看看这个 SO 问题 详情.
Look this SO Question for details.
这篇关于AngularJS 中的 Whatsapp 共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文