Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whatsapp Sharing in 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>

Do i need a directive for this? If yes, what is it? Someone with experience in AngularJS, kindly help.

like image 258
user3362364 Avatar asked Jul 25 '15 07:07

user3362364


1 Answers

You need to sanitize anchor href inside your config phase of angular, that will allow your href with whatsapp prefix.

Code

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

Look this SO Question for details.

like image 146
Pankaj Parkar Avatar answered Oct 21 '22 14:10

Pankaj Parkar