Skip to content

amlinger/angular-narrative-api

Repository files navigation

Build Status

Angular Narrative API

Note that this is only a pre-build, and is not recommended for use in production code

Narrative Open Platform made easy for AngularJS. For now, all API hooks in Narratives Open Platform is not supported, for a more complete overview of what can be accomplished with this tool and with Narratives Open Platform itself can be found using the links below.

Installation

This package currently supports installation by Bower.io. With Bower installed, simply type the following in a terminal window:

$ bower install angular-narrative-api --save

Where the --save flag saves this dependency to your bower.json.

After installation through bower, make sure to include the source file in your index.html or similar after your angular import.

<script src="link/to/angular.js"></script>
<script src="bower_components/angular-narrative-api/dist/angular-narrative-api.min.js"></script>

Usage

Register an app at Narrative Open Platform, and the following snippet can help you getting started.

angular.module('app', ['api.narrative'])
  .config(function (NarrativeAuthProvider , NarrativeRequestProvider) {
    NarrativeAuthProvider.defaults.oauthApplication = {
      clientID: "my-client-id",
      redirectURI: "my-root-uri",
      clientSecret: "my-client-secret"
    };
    // For now, Narrative does not support CORS on all URLS, so therefore a
    // proxy is usually necessary.
    NarrativeRequestProvider.defaults.api.proxy = 'http://cors.proxy/';
  })
  .controller('Controller', function (NarrativeAuth,  NarrativeApi) {
    // Go right ahead and use the Auth and the API!
  });

Manual installation

Simply download the angular-narrative-api.min.js (or angular-narrative-api.js for a unminified version) and include it in a similar fashion as above in your html.

Requirements

The only dependency for this module is, quite naturally, AngularJS version 1.4 or higher. For more information about development dependencies, please see package.json (and to some extent, bower.json).

Contribute

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request!

About

Narrative API services made easy for Angular.

Resources

Stars

Watchers

Forks

Packages

No packages published