Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
ng-social-links
Advanced tools
Headless social share for Angular. Provides straightforward API for getting social share URLs which can be used in your templates.
ng-social-links advantages:
Install package
npm i ng-social-links
Add import to your module
import { NgSocialLinksModule } from 'ng-social-links';
@NgModule({
imports: [
...
NgSocialLinksModule.forRoot(),
],
declarations: [],
providers: []
})
Inject the service:
import { NgSocialLinksService } from 'ng-social-links';
class SomeComponent {
constructor(private socialLinks: NgSocialLinksService) {}
}
Get the socail share links:
facebookShareLink = this.socialLinks.getShareLink('fa');
With additional parameters:
twitterShareLink = this.socialLinks.getShareLink('tw', { title: 'Visit my website!' });
The configuration interface looks like this:
interface Config {
url?: string;
title?: string;
description?: string;
}
By default document.location.href
is used for url
, title
and description
are empty.
You can define another defaults as follows:
NgSocialLinksModule.forRoot({ url: 'htts://my-website.com' })
Or
NgSocialLinksModule.forRoot({ title: 'Visit my website!', description: 'Default email body...' })
ng-social-links is headless, so you're free to use whatever you like in a template. e.g. text links, icons, buttons, you name it. For example:
<a [attr.href]="facebookShareLink">
<fa-icon [icon]="faFacebook"></fa-icon>
</a>
Another option is to create a popup window:
const telegramLink = facebookShareLink = this.socialLinks.getShareLink('tg');
window.open(telegramLink,'SocialSharePopup','width=600,height=600');
Currently, demo is only available on localhost:
npm install
.npm start
.You are more than welcome to improve this library (for example, add missing social share providers) or create issues on the GitHub issue tracker.
FAQs
Headless social share for Angular
The npm package ng-social-links receives a total of 37 weekly downloads. As such, ng-social-links popularity was classified as not popular.
We found that ng-social-links demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.