1

I am sharing a link http://35.154.102.35/index.html#/shareProfilein facebook. But sharing doesnt happen , it take shareProfile as userid and redirect to profile of person share.profile.What can be done to redirect to my link ?

HtmL:

 <div class="share-links">
      <a href="http://facebook.com/sharer.php?u={{shareVDetails}}" class="fa fa-facebook" target="_blank"></a>
    </div>

JS:

$scope.shareVDetails = "http://35.154.102.35/index.html#/shareProfile";
Nicoleta Wilskon
  • 687
  • 1
  • 10
  • 32

3 Answers3

1

try this

$scope.shareVDetails = "http://35.154.102.35/index.html#/shareProfile";

$scope.facebook = "http://facebook.com/sharer.php?u=" + $scope.shareVDetails;

on html

<a href="{{ facebook }}" >
0

Generally you want to use ng-href for links if you're using data in a controller as part of the link as per their doc.

https://docs.angularjs.org/api/ng/directive/ngHref

user441521
  • 6,942
  • 23
  • 88
  • 160
0

You need to encode url, because the hash sign is treated like it is part of facebook link not yours. So:

$scope.shareVDetails = encodeURIComponent("http://35.154.102.35/index.html#/shareProfile");
Bartek Cichocki
  • 660
  • 7
  • 10