Skip to content
This repository was archived by the owner on Mar 7, 2022. It is now read-only.

Commit 2043f94

Browse files
authored
Merge pull request #189 from overovermind/master
Add optional url parameter to sms share
2 parents d9b2975 + 9ab9907 commit 2043f94

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

Readme.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,9 @@ Method | Option | Type | Default | Description
404404
405405
Method | Option | Type | Default | Description
406406
------------- | ------------- | ------------- | ------------- | -------------
407-
sharer | socialshare-to="" | URL | page URL| Set the phone number of the contact
407+
sharer | socialshare-to="" | URL | false | Set the phone number of the contact
408408
sharer | socialshare-text="" | String | false | Set the content to share
409+
sharer | socialshare-url="" | URL | page URL| Set the url to share
409410
410411
##Options
411412

lib/angular-socialshare.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -820,10 +820,15 @@
820820
$log.warn('sending sms text with "%" sign is not supported');
821821
}
822822

823-
var body = encodeURIComponent(attrs.socialshareText.replace('%','')) + encodeURIComponent(attrs.socialshareUrl)
824-
, toPhoneNumber = attrs.socialshareTo || ''
825-
, urlString = 'sms:' + toPhoneNumber + '?&body=' + body;
826-
823+
var body = encodeURIComponent(attrs.socialshareText.replace('%',''))
824+
, toPhoneNumber = attrs.socialshareTo || '';
825+
826+
if (attrs.socialshareUrl) {
827+
body += encodeURIComponent(attrs.socialshareUrl);
828+
}
829+
830+
var urlString = 'sms:' + toPhoneNumber + '?&body=' + body;
831+
827832
element.attr('href', urlString);
828833
element.attr('target', '_blank');
829834
}

0 commit comments

Comments
 (0)