what am i trying to achieve is on click the generate a button that can handle the venets for Social Share. Im creating the button with all the attributes as described at https://github.com/720kb/angular-socialshare but when i click on the button nothing happens. I know that i have to bind the event after the button is created but i really dont know how.
var testingUrl = response.id;
var twitterButton = '<a id="thisButton"type="button" class="btns twitter-new twitter-skin mdm-btn pull-right" socialshare="" socialshare-provider="twitter" socialshare-trigger="click" socialshare-url="'+testingUrl+'" socialshare-hashtags="something, something, something" socialshare-via="something," socialshare-text="Checkout this chart" socialshare-popup-height="300" socialshare-popup-width="400" socialshare-trigger="click">Share to <i class="fa fa-twitter"></i></a>'
$('#chart_1_content').append(twitterButton);
You need to compile the HTML code first, in order to let angular recognize the directives. Something like this
var testingUrl = response.id;
var twitterButton = '<a id="thisButton"type="button" class="btns twitter-new twitter-skin mdm-btn pull-right" socialshare="" socialshare-provider="twitter" socialshare-trigger="click" socialshare-url="'+testingUrl+'" socialshare-hashtags="something, something, something" socialshare-via="something," socialshare-text="Checkout this chart" socialshare-popup-height="300" socialshare-popup-width="400" socialshare-trigger="click">Share to <i class="fa fa-twitter"></i></a>'
$('#chart_1_content').append($compile(twitterButton)($scope));
Also you might check if the value of testingUrl
is a valid URL.