Angular facebook service
17 people use it
Author: 5157537?v=3 GoDisco
Submitted by: 98982?v=3 AlmogBaku

Angular Facebook

Angular service to handle facebook


  1. Download the package, you can download the zip file, or use bower: bower install ng-facebook
  2. Include the Facebook SDK for javascript, BUT DO NOT initialize the sdk.
  3. Include ngFacebook in your application dependencies


You must configure your facebook application ID in your app, for example:

Additional configurations

You can also configure the next properties.

Use set and get. For example $facebookProvider.setAppId(11111)

  1. permissions(<string>) for permissions which required by your app.


  2. customInit(<object>) custom initial p.

    Example to set:



  1. $facebook.config(property) - Return the config property.
  2. $facebook.getAuthResponse() - Return the AuthResponse(assuming you already connected)
  3. $facebook.getLoginStatus() - Return promise of the result.
  4. $facebook.login() - Logged in to your app by facebook. Return promise of the result.
  5. $facebook.logout() - Logged out from facebook. Return promise of the result.
  6. $facebook.ui(params) - Do UI action(see facebook sdk docs). Return promise of the result.
  7. $facebook.api(args...) - Do API action(see facebook sdk docs). Return promise of the result.
  8. $facebook.cachedApi(args...) - Do API action(see above), but the result will cached. Return promise of the result.



The service will broadcast the facebook sdk events with the prefix fb..

In return you will get the next arguments to your $on handler: event,response,FB (FB is the facebook native js sdk).

  1. fb.auth.login
  2. fb.auth.logout
  3. fb.auth.prompt
  4. fb.auth.sessionChange
  5. fb.auth.statusChange
  6. fb.auth.authResponseChange
  7. fb.xfbml.render
  8. fb.edge.create
  9. fb.edge.remove
  10. fb.comment.create
  11. fb.comment.remove
  12. fb.message.send

For additional information about the events see the sdk docs.


This project is released over MIT license


AlmogBaku - by GoDisco

comments powered by Disqus
This page was last updated almost 4 years ago.