Angular-GAPI
Angular-GAPI is an AngularJS module for accessing different Google APIs.
The code is based on ngGAPI
Load
To use the module, include the main Angular-GAPI javascript file in your web page, as well as the scripts for all the API's that will be used:
//.....
ngGAPI requires Google API JavaScript client library
Installation
Bower
$ bower install quivr/angular-GAPI --save
Npm
$ npm install quivr/angular-GAPI --save
then load it in your html
Add module dependency
angular;
Usage
After you register your app in the Google APIs Console, configure angular-GAPI with credentials and whatever scopes you need for your app.
angular value'GoogleApp' apiKey: 'YOUR_API_KEY' clientId: 'YOUR_CLIENT_ID' scopes: // whatever scopes you need for your app, for example: 'https://www.googleapis.com/auth/drive' 'https://www.googleapis.com/auth/youtube' 'https://www.googleapis.com/auth/userinfo.profile' // ...
To use a specific service, inject it into your controllers by name. All GAPI methods return a promise.
angular ;
Services
GAPI authorization
- GAPI.init()
- GAPI.disconnect()
Note: If pop-ups are being blocked, make sure to have gapi loaded before calling GAPI.init().
gapi;
For a full documentation of the available functions, consult the wiki