This is a wrapper for the official Facebook JavaScript SDK. It makes it easier to use Facebook SDK with Angular 2+ by providing components, providers and types.
Installation
1. Install via NPM:
npm i --save ngx-facebook
2. Add the Facebook JavaScript SDK to your index.html
3. Import FacebookModule into your app's root module
import{FacebookModule}from'ngx-facebook';
@NgModule({
...
imports: [
FacebookModule.forRoot()
],
...
})
exportclassAppModule{}
If you only want to use FacebookService only, without using the other components, then you can import it in your app's module instead of FacebookModule.
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.
A large portion of this module's documentation is copied from the official Facebook Docs. This is to make sure that everything is as clear as possible, and consistent with the way Facebook explains it.