AngularJS中的Whatsapp共享

use*_*364 5 anchor href angularjs whatsapp angularjs-directive

它本身应该很简单,因为这段代码无法检测到AngularJS代码,所以它无法正常工作.

    <a href="whatsapp://send?text={{challenge.challenge_title}}" 
            data-action="{{FullURL}}">Whatsapp</a>
Run Code Online (Sandbox Code Playgroud)

我需要这个指令吗?如果是,那是什么?有AngularJS经验的人,请帮忙.

Pan*_*kar 10

您需要hrefconfig角度阶段内清理锚点,这将允许您的href带有whatsapp前缀.

app.config(function($compileProvider){
   //other configuration code here
   $compileProvider.aHrefSanitizationWhitelist(/^\s*(whatsapp):/);
})
Run Code Online (Sandbox Code Playgroud)

看看这个SO问题了解详情.