New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@zomoz/ngx-share

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zomoz/ngx-share

Share buttons components for Angular and Ionic.

  • 5.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Angular Share Buttons

Capture

npm npm Build Status npm

stackblitz

Share button directive

Convert any element to a share button using [shareButton] directive.

Install with npm

$ npm install --save @ngx-share/core

Import ShareModule in your module

import { ShareModule } from '@ngx-share/core';

@NgModule({
  imports: [
    HttpClientModule,      // (Required) for share counts
    HttpClientJsonpModule, // (Optional) For linkedIn & Tumblr counts
    ShareModule.forRoot()
  ]
})

In your template

<button shareButton="facebook">Share</button>
<button shareButton="twitter">Tweet</button>
<button shareButton="pinterest">Pin</button>

To use the default icons or colors, use ShareButtons service so you can access buttons properties

import { ShareButtons } from '@ngx-share/core';

@Component({
  // ...
})
export class MyComponent {
  constructor(public share: ShareButtons) {
  }
}

Now you can set them

<!--Set color and icon-->
<button shareButton="twitter" [style.backgroundColor]="share.prop.twitter.color">
  <i [class]="share.prop.twitter.icon"></i>
</button>

<!--Material example-->
<button md-icon-button shareButton="telegram" [style.color]="share.prop.telegram.color">
  <i [class]="share.prop.telegram.icon"></i>
</button>

Check ShareButton Directive Demo

NameDefault valueDescription
[shareButton]nullButton name, e.g. 'facebook', 'twitter' ...etc.
[sbUrl]current URLSharing link.
[sbTitle]nullOverride title meta tag for LinkedIn and Reddit.
[sbDescription]nullOverride description meta tag for LinkedIn, WhatsApp, Telegram and Pinterest
[sbImage]nullOverride image meta tag for Pinterest only.
[sbTags]nullOverride tags for Tumblr and Twitter.
(sbOpened)button nameStream that emits when share window has opened.
(sbClosed)button nameStream that emits when share dialog has closed.
(sbCount)share countStream that emits share count of the share URL.

Issues

If you identify any errors in this component, or have an idea for an improvement, please open an issue. I am excited to see what the community thinks of this project, and I would love your input!

Support

npm

Author

Murhaf Sousli

License

More plugins from the author

Keywords

FAQs

Package last updated on 09 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc