File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,33 @@ import 'wp-api-angularjs';
31
31
bower install shprink/wp-api-angularjs
32
32
```
33
33
34
+ ## Setup
35
+
36
+ To setup wp-api-angularjs in your app:
37
+
38
+ ```
39
+ var app = angular.module('app', ['wp-api-angularjs']);
40
+
41
+ app.config(function (WpApiProvider) {
42
+ WpApiProvider.setBaseUrl('http://www.example.com/wp-json/');
43
+ });
44
+
45
+ app.controller('PostsController', ['$scope', '$wpApiPosts', PostsController]);
46
+
47
+ function PostsController($scope, $wpApiPosts) {
48
+ $scope.posts = [];
49
+
50
+ $wpApiPosts.getList({
51
+ page: 1,
52
+ per_page: 10
53
+ }).then(function (posts) {
54
+ $scope.posts = posts.data;
55
+ });
56
+ }
57
+
58
+
59
+ ```
60
+
34
61
## Authentication
35
62
36
63
This library only supports basic auth. OAuth1 not being suitable for JS clients (it would mean exposing key and password out of the open)
You can’t perform that action at this time.
0 commit comments