Model service - MurhafSousli/ngx-wordpress GitHub Wiki

Use WpService to get a single post by ID, here is a basic example

constructor(public wp: WpService) { }

ngOnInit() {
   this.wp.model().posts().get(215).subscribe((res: ModelResponse) => {
      // Handle the response here
   });
}

Model Service Options:

//get a single post by id
wp.model().posts().get(id, args?)  // get a single post by id, query arguments is optional

//add new post
wp.model().posts().add(body);

//update post by id
wp.model().posts().update(id, body);

//delete post by id
wp.model().posts().delete(id);