Reputation: 697
I am sharing a link http://35.154.102.35/index.html#/shareProfile
in 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";
Upvotes: 1
Views: 173
Reputation: 686
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 }}" >
Upvotes: 1
Reputation: 661
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");
Upvotes: 0
Reputation: 6988
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
Upvotes: 0