ng-socializer
v1.0.0-beta.4
Published
A Collection of Angular Services for Social Network Integration.
Downloads
12
Maintainers
Readme
ng-socializer 
A Collection of Angular Services for Social Integration.
Do you find integrating social network into your angular application harder? Fear no more, ng-socializer lets you integrate social networks such as facebook, google, instagram pinterest and linkedin easily.
Features
- Supports facebook, google, instagram, pinterest and linkedin.
- Easy and common API for all supported social networks.
- Common data structure for user profile reponse.
- RxJS observable based.
- Strongly typed API.
Installation
npm install --save ng-socializer
How To
- Import SocializerModule into Your App/Root Module
import { SocializerModule } from 'ng-socializer';
@NgModule({
...
imports: [
SocializerModule.forRoot()
]
...
})
export class AppModule { }
- Import and initialize the social sdk that you need from any component
import { FacebookSocializer } from 'ng-socializer';
export class MySocialComponent implements OnInit {
constructor(private facebookSocializer: FacebookSocializer) {}
ngOnInit() {
this.facebookSocializer.init({ appId: appId }).subscribe();
}
}
- Use the service to connect and get user's profile informations
import { FacebookSocializer, SocialProfile } from 'ng-socializer';
export class MySocialComponent implements OnInit {
...
ngOnInit() {
...
// Everytime User Connects or Disconnects, A Value will be Emmited from profile$ Observable
this.facebookSocializer.profile$.subscribe((profile) => {
console.log(profile);
});
}
// Call This Method from View on Click Event
connectWithFacebook() {
this.facebookSocializer.connect().subscribe();
}
// Don't Forget to Unsubscribe
ngOnInit() {
if (this.facebookSocializer.profile$) {
this.facebookSocializer.profile$.unsubscribe();
}
}
...
}
Documentation
Coming Soon...
Enjoy 😃