ng-socializer
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.0-beta.4 • Public • Published

    ng-socializer Tweet

    A Collection of Angular Services for Social Integration.

    License: MIT NPM version

    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

    1. Import SocializerModule into Your App/Root Module
    import { SocializerModule } from 'ng-socializer';
     
    @NgModule({
      ...
      imports[
        SocializerModule.forRoot()
      ]
      ...
    })
    export class AppModule { }
    1. 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();
      }
    }
    1. 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 😃

    Install

    npm i ng-socializer

    DownloadsWeekly Downloads

    1

    Version

    1.0.0-beta.4

    License

    MIT

    Unpacked Size

    351 kB

    Total Files

    23

    Last publish

    Collaborators

    • sabbirrahman