Skip to content

Commit

Permalink
added installation instructions to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
cef62 committed Jan 13, 2015
1 parent 2443d19 commit a247fce
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion readme.md
Expand Up @@ -8,6 +8,8 @@ The `xyz.angular.swapi` modules comes with one angular constant `swapiEndpoints`

To use the service just import the module in your AngularJS application and inject the `swapiService` whre required.

In your javascript:

```javascript
// include the module
angular.module('myStarWarsApp', ['xyz.angular.swapi']).
Expand All @@ -23,6 +25,8 @@ controller('jediController', ['swapiService',
])
```

Inside your view template:

```html
<ul>
<li>Name: {{luke.name}}</li>
Expand All @@ -31,7 +35,25 @@ controller('jediController', ['swapiService',
</ul>
```

For any end-point exposed by **swapi.com** 3 methods are available:
## Installation

The module can be installed from **bower**:

```
$ bower install xyz-angular-swapi --save
```

from **npm**:

```
$ npm install xyz-angular-swapi --save
```

or downloading directly the [minified version](https://github.com/unshift-devs/xyz-angular-swapi/blob/master/dist/xyz-angular-swapi.min.js).

## Service API

For every end-point exposed by **swapi.com** 3 methods are available:

* get specific resource by type and id
* get all resources for a given type
Expand Down Expand Up @@ -75,6 +97,11 @@ Complete API, all methods return a promise.
* `vehicles([page])` return all vehicles paginated. If no page is passed defaults to 1.
* `vehicleSchema()` return the JSON Schema for the `vehicle` resource

### additional methods

* `resources()` return the available REST resources
* `resource(url)` load a valid REST resource url, not only from **swapy.com**

## Work in progress

An integration with the local storage has been already done but has external dependencies. Will be added as soon as we can remove all dependencies.

0 comments on commit a247fce

Please sign in to comment.