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屋!
查看全文