ng-apihandler
v1.0.0
Published
An AngularJS module for use all Google Apis and your Google Cloud Endpoints (Google App Engine) Using angular gapi, For Encapsulation
Maintainers
Readme
ngApiHandler
An AngularJS module for use all Google Apis and your Google Cloud Endpoints (Google App Engine) Using angular gapi , For Encapsulation.
Requirements
Installation
Add library
This module is available as bower package, install it with this command:
bower install ngApiHandlerand it's available too as npm package, install it with this command:
npm install ng-apihandleror you may download the latest release
Include library
For npm dependencies installation
<script type="text/javascript" src="/ng-apihandler/dist/angular-google-gapi.min.js"></script>For bower dependencies installation
<script type="text/javascript" src="/ngApiHandler/dist/angular-google-gapi.min.js"></script>Add dependency
var app = angular.module('myModule', ['ngApiHandler']);Configuration
without Google Auth
add run in root module
app.run(['ApiHandler',
function(ApiHandler) {
ApiHandler.connectApi('myApiName','v1');//calling this for access to get all method from the myApiName class api
}
]);Use
Execute our api
app.controller('myController', ['$scope', 'ApiHandler',
function myController($scope, ApiHandler) {
param={};//or {item:value[,item1:value1]}
ApiHandler.callService('myApiName', 'you.api.method.name',param}).then( function(resp) {
//success
console.info(resp);
}, function(err) {
//failure
console.error(err);
});
}
]);