Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/skyfloyd/ionic2-fb-gallery

Facebook gallery photo picker for Ionic 2
https://github.com/skyfloyd/ionic2-fb-gallery

Last synced: 3 months ago
JSON representation

Facebook gallery photo picker for Ionic 2

Awesome Lists containing this project

README

        

# ionic2-fb-gallery
Facebook gallery photo picker for Ionic 2

## Installation

* Create Ionic project
* Install `cordova-plugin-facebook4` by this command
```bash
$ ionic plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"
```
Find more details here [https://ionicframework.com/docs/v2/native/facebook/](https://ionicframework.com/docs/v2/native/facebook/)
* Copy `ionic2-fb-gallery` `module` folder to `app` folder
* Import `FbModule` to your app base `@NgModule`

## Usage

* Call init() method of SocialApiService class object. Example here:
```bash
constructor( private socialApi:SocialApiService ) {
this.socialApi.subscribeToStatusChange( ()=>{ /* onApiReady(); */ }, SocialApiService.getApiStatus_appUser() );
this.socialApi.init();
}
```
This plugin use [ionic2-fb-api](https://github.com/skyfloyd/ionic2-fb-api/) plugin to connect with Facebook. Please take a look to [ionic2-fb-api documentation](https://github.com/skyfloyd/ionic2-fb-api/) for more info.

* You have 2 options to open Facebook gallery photo picker dialog
* Call `FbGallery` `init` function. It takes your callback as it's only parameter. Example here:
```bash
constructor( private fbGallery:FbGallery ) {}

public chooseFromFacebook():void{
this.fbGallery.init((url, name)=>{
/* do something here */
});
}
```

* Use `fb-gallery` directive. Example here:

**HTML file**
```bash


Choose from Facebook

```

**TypeScript file**
```bash
public facebookGalleryCallback():any{
return (url, name)=>{
/* do something here */
};
}
```

## DEMO

[ionic2-fb-api DEMO](https://www.youtube.com/watch?v=dhC_6VZnI1w)

Thats all.