Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-GAPI

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-GAPI

A Google API module for AngularJS

  • 0.5.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

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:

<!DOCTYPE HTML>
<html>
<body ng-app="app">
  //.....
  <script src="bower_components/angular-GAPI/lib/angular-GAPI.js"></script> 
  <script src="bower_components/angular-GAPI/lib/plugin/gapi.calendar.factory.js"></script> 
  <script src="bower_components/angular-GAPI/lib/plugin/gapi.user.factory.js"></script>
</body>
</html>

ngGAPI requires Google API JavaScript client library

<script src="https://apis.google.com/js/client.js"></script>

##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.module('app', [
  'angularGAPI'
]);

##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.module('myApp')
  .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.module('myApp')
  .controller('VideosCtrl', function ($scope, Youtube) {
    $scope.videos = Youtube.search({ part: 'snippet', q: 'Search terms' })
  });

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.load('auth', function() { GAPI.init() });

For a full documentation of the available functions, consult the wiki

Keywords

FAQs

Package last updated on 24 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc