Cutting edge websites for the 19th Century

posts tagged ‘angular’

Problem: how to get Wordpress-style pretty permalinks into an Angular app? I want my permalinks to have this format:
http://domain.com/2017/02/post-slug-here/
I want single posts and category and tag archives to contain slugs, not IDs in the URL.
This is not hard to achieve with Angular UI-router. This is how I do it..

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.…