Angularjs share to social networks

NSCoder picture NSCoder · May 10, 2014 · Viewed 22.5k times · Source

I'm using angularjs and wanted to add share buttons to my pages for different social networking sites. So far I've found Angular-socialshare and Socialitejs but don't know which one to choose or if other really good ones exist, that I don't even know of.

Answer

sinisterOrange picture sinisterOrange · Aug 21, 2014

Here is an alternative to angular-socialshare (has share counter) that is currently the most popular/active on GitHub:

http://github.com/esvit/angular-social

Here is a simplified share button (no counter). This directive uses Font Awesome as a dependency.

http://github.com/tinacious/angular-easy-social-share


A note about metadata scraping and single page applications

Keep in mind that social network crawlers, which scrape HTML metadata for rich snippets (like OpenGraph links to images and descriptions), do not evaluate JavaScript. This can render certain meta tags in the header as {{bracketed}} expressions in a share box rather than dynamically loaded content... Assuming you have metadata that is loaded dynamically with AngularJS.

Check out this article about sharing rich snippets with Angular should you have that requirement: http://www.michaelbromley.co.uk/blog/171/enable-rich-social-sharing-in-your-angularjs-app