Skip to content

Commit 5c54447

Browse files
committed
finishing all entities with all GET methods
1 parent 5df140b commit 5c54447

27 files changed

+2405
-245
lines changed

README.md

Lines changed: 11 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,23 @@
11
wp-api-angularjs
22
================
33

4-
wp-api-angularjs is under development and will only cover GET methods of the [WP-API](https://github.com/WP-API/WP-API) master branch.
4+
AngularJS services to consume [WP-API v2](http://v2.wp-api.org/)
55

6-
## Install
7-
8-
wp-api-angularjs depends on [Restangular](https://github.com/mgonto/restangular) that itself depends on [Underscore](https://github.com/jashkenas/underscore) or [Lodash](https://github.com/lodash/lodash)
6+
## Documentation
97

10-
include the bundled version ```dist/wp-api-angularjs.bundle.js``` (that includes Restangular) or ```dist/wp-api-angularjs.js``` (that does not include Restangular)
11-
12-
Do not forget to include [Underscore](https://github.com/jashkenas/underscore) or [Lodash](https://github.com/lodash/lodash) in your project.
13-
14-
```
15-
angular.module('myApp', ['wp-api-angularjs']);
16-
```
17-
18-
## Services
19-
20-
### WpApiProvider
21-
22-
wp-api-angularjs is based on Restangular therefore you can use any of the [Restangular Provider methods](https://github.com/mgonto/restangular/tree/1.4.0#configuring-in-the-config)
23-
24-
```
25-
.config(function(WpApiProvider) {
26-
var RestangularProvider = WpApiProvider.getRestangularProvider();
27-
RestangularProvider.setBaseUrl('/api/v1');
28-
});
29-
```
30-
31-
wp-api-angularjs always returns promises:
32-
33-
```
34-
$wpApiPosts.$get(id).then(function(post) {
35-
// OK
36-
}).catch(function() {
37-
// KO
38-
});
39-
```
40-
41-
### Posts ```$wpApiPosts```
42-
43-
```
44-
// Get latests posts
45-
$wpApiPosts.$getList();
46-
47-
// Get filtered posts
48-
$wpApiPosts.$getList({
49-
"page" : 2,
50-
"filter[category_name]": "uncategorized",
51-
"filter[posts_per_page]": 5,
52-
"filter[orderby]": "date",
53-
"filter[order]": "desc",
54-
"filter[post_status]": "publish"
55-
});
56-
57-
$wpApiPosts.$get(id);
58-
59-
# DOES NOT WORK FOR NOW
60-
$wpApiPosts.$create();
61-
```
62-
63-
### Media ```$wpApiMedia```
64-
65-
```
66-
$wpApiMedia.$getList();
67-
$wpApiMedia.$get(id);
68-
69-
# DOES NOT WORK FOR NOW
70-
$wpApiMedia.$create();
71-
```
72-
73-
### Users ```$wpApiUsers```
74-
75-
Requires [authentication](http://wp-api.org/guides/authentication.html)
76-
77-
```
78-
$wpApiUsers.$getList();
79-
$wpApiUsers.$get(id);
80-
$wpApiUsers.$getMe();
81-
82-
# DOES NOT WORK FOR NOW
83-
$wpApiMedia.$create();
84-
```
85-
86-
### Taxonomies ```$wpApiTaxonomies```
87-
88-
```
89-
$wpApiTaxonomies.$getList();
90-
$wpApiTaxonomies.$get(taxonomy);
91-
$wpApiTaxonomies.$getTermList(taxonomy);
92-
$wpApiTaxonomies.$getTerm(taxonomy, id);
93-
```
8+
<http://shprink.github.io/wp-api-angularjs/>
949

9510
## Contribute
9611

9712
```
98-
sudo npm install webpack webpack-dev-server -g
9913
npm install
100-
webpack-dev-server
14+
15+
# Open two terminals
16+
# and run watch to build on the lib files changes
17+
npm run watch
18+
19+
# in the other terminal run following to build the test page and the doc
20+
npm run devserver
10121
```
10222

103-
Open ```http://localhost:8080/test.html```
23+
Open ```http://localhost:8080```

0 commit comments

Comments
 (0)