Skip to content

Instantly share code, notes, and snippets.

@dima-f1
Forked from dpogorzelski/directives.js
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save dima-f1/4546678c0bd6f66e171c to your computer and use it in GitHub Desktop.

Select an option

Save dima-f1/4546678c0bd6f66e171c to your computer and use it in GitHub Desktop.
Twitter share directive
directives.directive('twitter', [
function() {
return {
link: function(scope, element, attr) {
setTimeout(function() {
twttr.widgets.createShareButton(
attr.url,
element[0],
function(el) {}, {
count: 'none',
text: attr.text
}
);
});
}
}
}
]);
<script src="http://platform.twitter.com/widgets.js"></script>
<a twitter data-text="Your text: {{file.name}}" data-url="http://127.0.0.1:3000/{{file.link}}"></a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment