All Projects → zyra → Ngx Facebook

zyra / Ngx Facebook

Licence: mit
Angular TypeScript Wrapper for Facebook SDK

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Ngx Facebook

ionic-modal-custom-transitions
Add Custom Transitions to Ionic Modals.
Stars: ✭ 22 (-89.72%)
Mutual labels:  angular2, angular4, ionic2
angular-progress-bar
This component allow you to easy incorporate progress-bar to angular/ionic project, providing binding and color options
Stars: ✭ 26 (-87.85%)
Mutual labels:  angular2, angular4, ionic2
Dianoia-app
Mobile (Ionic 3 - Angular 4) app about non-pharmaceutical activities and information for people with dementia.
Stars: ✭ 13 (-93.93%)
Mutual labels:  angular2, angular4, ionic2
Ionic3 Components
A project full of ionic 3 components and samples - to make life easier :)
Stars: ✭ 1,689 (+689.25%)
Mutual labels:  ionic2, angular2, angular4
Ion2 Calendar
📅 A date picker components for ionic2 /ionic3 / ionic4
Stars: ✭ 537 (+150.93%)
Mutual labels:  ionic2, angular2, angular4
Ionic Audio
An audio player for Ionic 3 and Angular 4. Works with HTML 5 audio or native audio using Cordova Media plugin.
Stars: ✭ 332 (+55.14%)
Mutual labels:  ionic2, angular2, angular4
ionic-uuchat
基于ionic3,angular4的实时聊天app,兼容web端。该项目只是前端部分,所有数据需要请求后端服务器,需要配套express-uuchat-api使用。
Stars: ✭ 14 (-93.46%)
Mutual labels:  angular2, angular4, ionic2
Ionic2 Rating
⭐️ Angular star rating bar. Built for Ionic 2+.
Stars: ✭ 177 (-17.29%)
Mutual labels:  ionic2, angular2, angular4
Drip Ionic3
「水滴打卡」App Open Source Code Base On Ionic V3 Framework
Stars: ✭ 74 (-65.42%)
Mutual labels:  ionic2, angular2, angular4
Ionic2 Pokedex
🎮 Pokédex sample app developed with Ionic 2, Angular 2 and Apache Cordova. Using Pokéapi as source for data.
Stars: ✭ 143 (-33.18%)
Mutual labels:  ionic2, angular2, angular4
Ngx Qrcode
An Angular 9/10 Component Library for Generating QR (Quick Response) Codes
Stars: ✭ 161 (-24.77%)
Mutual labels:  angular2, angular4
Ngx Popper
An angular wrapper for popper.js, great for tooltips and positioning popping elements
Stars: ✭ 183 (-14.49%)
Mutual labels:  angular2, angular4
Angular Development With Primeng
Code samples from the book "Angular UI Development with PrimeNG"
Stars: ✭ 159 (-25.7%)
Mutual labels:  angular2, angular4
Ngx Gauge
A highly customizable Gauge component for Angular 9+ apps and dashboards
Stars: ✭ 158 (-26.17%)
Mutual labels:  angular2, angular4
Ngx Daterangepicker Material
Pure Angular 2+ date range picker with material design theme, a demo here:
Stars: ✭ 169 (-21.03%)
Mutual labels:  angular2, angular4
Angular Google Maps
Angular 2+ Google Maps Components
Stars: ✭ 1,982 (+826.17%)
Mutual labels:  angular2, angular4
Ngx Inline Editor
Native UI Inline-editor Angular (4.0+) component
Stars: ✭ 172 (-19.63%)
Mutual labels:  angular2, angular4
Ngx Socket Io
Socket.IO module for Angular
Stars: ✭ 178 (-16.82%)
Mutual labels:  angular2, angular4
Truly Ui
Truly-UI - Web Angular UI Components for Desktop Applications (Electron, NW, APP JS)
Stars: ✭ 195 (-8.88%)
Mutual labels:  angular2, angular4
Angular2 Crud Rest
Sample Angular (2.x and 4.x) app: CRUD example + routing
Stars: ✭ 152 (-28.97%)
Mutual labels:  angular2, angular4

ngx-facebook

This is a wrapper for the official Facebook JavaScript SDK. It makes it easier to use Facebook SDK with Angular by providing components, providers and types.

npm Build Status npm npm

Installation

1. Install via NPM:

npm i -S ngx-facebook

2. Add the Facebook JavaScript SDK to your index.html

<script type="text/javascript" src="https://connect.facebook.net/en_US/sdk.js"></script>

3. Import FacebookModule into your app's root module

import { FacebookModule } from 'ngx-facebook';

@NgModule({
  ...
  imports: [
    FacebookModule.forRoot()
  ],
  ...
})
export class AppModule { }

4. Inject FacebookService and call the init method (optional):

This method must be called before using login or api methods. It is not required for other methods/components.

import { FacebookService, InitParams } from 'ngx-facebook';

...

export class MyComponentOrService {

  constructor(private fb: FacebookService) {

    const initParams: InitParams = {
      appId: '1234566778',
      xfbml: true,
      version: 'v2.8'
    };

    fb.init(initParams);

  }

}

Documentation

You can view complete and detailed documentation by visiting https://zyra.github.io/ngx-facebook/.

Example Usage

You can view our example project here and/or view its source code here

Example of login with Facebook

import { FacebookService, LoginResponse } from 'ngx-facebook';

@Component(...)
export class MyComponent {

  constructor(private fb: FacebookService) { }

  loginWithFacebook(): void {

    this.fb.login()
      .then((response: LoginResponse) => console.log(response))
      .catch((error: any) => console.error(error));
  }

}

Example of sharing on Facebook

import { FacebookService, UIParams, UIResponse } from 'ngx-facebook';

...

share(url: string) {

  const params: UIParams = {
    href: 'https://github.com/zyra/ngx-facebook',
    method: 'share'
  };

  this.fb.ui(params)
    .then((res: UIResponse) => console.log(res))
    .catch((e: any) => console.error(e));

}

Example of adding a Facebook like button

<fb-like href="https://github.com/zyra/ngx-facebook"></fb-like>

Example of playing a Facebook video

Basic video component usage:

<fb-video href="https://www.facebook.com/facebook/videos/10153231379946729/"></fb-video>

Advanced video component usage:

<fb-video href="https://www.facebook.com/facebook/videos/10153231379946729/" (paused)="onVideoPaused($event)"></fb-video>
import { Component, ViewChild } from '@angular/core';
import { FBVideoComponent } from 'ngx-facebook';

@Component(...)
export class MyComponent {

  @ViewChild(FBVideoComponent) video: FBVideoComponent;

  ngAfterViewInit() {
    this.video.play();
    this.video.pause();
    this.video.getVolume();
  }

  onVideoPaused(ev: any) {
    console.log('User paused the video');
  }

}

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Contribution

  • Having an issue? or looking for support? Open an issue and we will get you the help you need.
  • Got a new feature or a bug fix? Fork the repository, make your changes, and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Support this project

If you find this project useful, please star the repository to let people know that it's reliable. Also, share it with friends and colleagues that might find this useful as well. Thank you 😄

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].