wp-api-angularjs
Angular2 services to consume WP-API v2 (< 2.5kb gziped)
If you want to use AngularJS v1, here is the latest version: v2.0.0-rc3
Installation
npm install wp-api-angularjs
Bootstrap
; ; ;
API
Every method return an Obervable. If you want to get a Promise you will need to add the rxjs toPromise
operator:
; { thiswpApiPosts }
RequestOptionsArgs
Every request can have an optional RequestOptionsArgs
object.
url : string method : string|RequestMethod search : string|URLSearchParams headers : Headers body : any withCredentials : boolean
This is where you can add query string to your request or change the headers.
WpApiPosts
getListoptions?: RequestOptionsArgs: Observable<Response>; getpostId, options?: RequestOptionsArgs: Observable<Response>; createbody: any, options?: RequestOptionsArgs: Observable<Response>; updatepostId, body: any, options?: RequestOptionsArgs: Observable<Response>; deletepostId, options?: RequestOptionsArgs: Observable<Response>; getMetaListpostId, options?: RequestOptionsArgs: Observable<Response>; getMetapostId, metaId, options?: RequestOptionsArgs: Observable<Response>; getRevisionListpostId, options?: RequestOptionsArgs: Observable<Response>; getRevisionpostId, revisionId, options?: RequestOptionsArgs: Observable<Response>; getCategoryListpostId, options?: RequestOptionsArgs: Observable<Response>; getCategorypostId, categoryId, options?: RequestOptionsArgs: Observable<Response>; getTagListpostId, options?: RequestOptionsArgs: Observable<Response>; getTagpostId, tagId, options?: RequestOptionsArgs: Observable<Response>;
WpApiPages
getListoptions?: RequestOptionsArgs: Observable<Response>; getpageId: number, options?: RequestOptionsArgs: Observable<Response>; createbody: any, options?: RequestOptionsArgs: Observable<Response>; updatepageId: number, body: any, options?: RequestOptionsArgs: Observable<Response>; delete
WpApiComments
getListoptions?: RequestOptionsArgs: Observable<Response>; getcommentId: number, options?: RequestOptionsArgs: Observable<Response>; createbody: any, options?: RequestOptionsArgs: Observable<Response>; updatecommentId: number, body: any, options?: RequestOptionsArgs: Observable<Response>; delete
WpApiTypes
getListoptions?: RequestOptionsArgs: Observable<Response>; getpostType: string, options?: RequestOptionsArgs: Observable<Response>;
WpApiMedia
getListoptions?: RequestOptionsArgs: Observable<Response>; getmediaId: number, options?: RequestOptionsArgs: Observable<Response>; createbody: any, options?: RequestOptionsArgs: Observable<Response>; updatemediaId: number, body: any, options?: RequestOptionsArgs: Observable<Response>; delete
WpApiUsers
getListoptions?: RequestOptionsArgs: Observable<Response>; meoptions?: RequestOptionsArgs: Observable<Response>; getuserId: number, options?: RequestOptionsArgs: Observable<Response>; createbody: any, options?: RequestOptionsArgs: Observable<Response>; updateuserId: number, body: any, options?: RequestOptionsArgs: Observable<Response>; delete
WpApiTaxonomies
getListoptions?: RequestOptionsArgs: Observable<Response>; gettaxonomiesType: string, options?: RequestOptionsArgs: Observable<Response>;
WpApiStatuses
getListoptions?: RequestOptionsArgs: Observable<Response>; getstatusesName: string, options?: RequestOptionsArgs: Observable<Response>;
WpApiTerms
taxonomiesType
can be tags
, categories
and more.
getListtaxonomiesType: string, options?: RequestOptionsArgs: Observable<Response>; gettaxonomiesType: string, termId: number, options?: RequestOptionsArgs: Observable<Response>; createtaxonomiesType: string, body: any, options?: RequestOptionsArgs: Observable<Response>; updatetaxonomiesType: string, termId: number, body: any, options?: RequestOptionsArgs: Observable<Response>; delete
WpApiCustom
getListoptions?: RequestOptionsArgs: Observable<Response>; getcustomId: number, options?: RequestOptionsArgs: Observable<Response>; createbody: any, options?: RequestOptionsArgs: Observable<Response>; updatecustomId: number, body: any, options?: RequestOptionsArgs: Observable<Response>; delete
Authentication
TO BE DEFINED
Contribute
npm installcp config.dist.json config.json # Open two terminals # and run watch to build on the lib files changes npm run watch # in the other terminal run following to build the test page and the doc npm run devserver
Open http://localhost:8080