/angular-google-endpoints

Integration of Google Endpoints with AngularJS

GNU General Public License v3.0GPL-3.0

angular-google-endpoints

This projects aims at providing a clean interface to Google Endpoints for your AngularJS application.

For generic details on how to use Google Enpoints from JavaScript, check the official documentation. To get an idea of what inspired me to do this, read the amazing article AngularJS + Cloud Endpoints: A Recipe for Building Modern Web Applications.

Step 1: Add Google API's JavaScript client library

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

Step 2: Map the Endpoints API to a resource

angular.module('myApp.resources', [])
  .factory('MyResource', ['endpointsClient', function (endpointsClient) {
    return endpointsClient.Resource(
      'your_api_name', 'v1', 'https://your_app_id.appspot.com/_ah/api',
      {
        do_something: 'do_something',
        update: 'patch',
        remove: 'remove'
      }
  );
}]);

Step 3: Use it!

angular.module('myApp.controllers', [])
  .controller('HomeCtrl', ['$scope', 'MyResource',
    function ($scope, MyResource) {
      $scope.load_completed = false;

      MyResource.do_something({action_type: 'cool stuff'})
        .then(function (response) {
          $scope.result = response.action_result;
          $scope.load_completed = true;
      });
    }
  ]);

TODO