posts tagged ‘angular’
I added pagination to this site’s headless theme. Its and Angular client for a WordPress API.
The key to this is knowing what Angular’s ui-router can do. This post by Aviv Ben-Yosef was very helpful: Simple pagination and URL params with ui-router. It explains how to set up routes with ‘squashed’ parameters, and make simple pagination functions in your controller.
Another helpful find was in Kadam White’s wpapi utility, which does the actual interaction with my WordPress JSON API.…
I coded up an Angular 1.5 app that shows the posts from my WordPress blog. It fetches post data from this site’s Rest API.
A proof-of-concept is here: Cherrytree.
The repo is on my Github: Topheavy-Angular.
It shows a ‘default’ listing of posts on the front page, which is equivalent to the default WordPress loop. I has single post views with the same URL structure as my WordPress permalinks.…