ng-api-handler
v1.0.2
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 ng-api-handlerand it's available too as npm package, install it with this command:
npm install ng-api-handleror you may download the latest release
Include library
<script type="text/javascript" src="/ng-api-handler/ng-api-handler.js"></script>Add dependency
var app = angular.module('myModule', ['ng-api-handler']);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);
});
}
]);