Skip to content

Share Buttons Component

Murhaf Sousli edited this page May 16, 2017 · 30 revisions

Add share buttons for your favorite share services

Basic usage:

<share-buttons [url]="linkToShare"></share-buttons>

The default usage comes with icons from fontawesome, make sure you import it in your app.

It's recommended to use the open graph meta tags to set the title, description and image for all share buttons.

Alternatively you can set them directly from the component as link parameters, however some share services do not accept link parameters (like google+)

<share-buttons [url]="linkToShare" [title]="title" [description]="description" [image]="image"></share-buttons>

Options:

  • [url] If URL is invalid or not presented, it will use the current url

Share links (by default it uses meta tags from head):

  • [title] Add title text
  • [description] Add description text
  • [image] Add Image
  • [tags] Add hashtags

Check input compatibility with each social network.

Buttons templates: Pass a custom button template to replace the default icons, Switch off a button by passing false

  • [facebook]
  • [twitter]
  • [linkedIn]
  • [tumblr]
  • [google]
  • [pinterest]
  • [stumbleUpOn]
  • [reddit]

Options:

  • [showCount] Enable counts on share buttons, default: false
  • [defaultStyle] Use default style is applied to the buttons, default: true
  • [buttonClass] Add custom classes to all buttons
  • (count) Output all buttons' counts
  • (popUpClosed) Output when pop up window is closed