Created
August 27, 2013 08:16
-
-
Save dpogorzelski/6350967 to your computer and use it in GitHub Desktop.
Twitter share button as AngularJS directive.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
); | |
}); | |
} | |
} | |
} | |
]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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
How can I change the style of the button?