Learning AngularJS For WordPress Development

At WordCamp Miami this year, I showed how and why, I use AngularJS for building WordPress plugin admin interfaces. For our A/B Testing plugin Ingot we chose to build our interface in Angular beacuse it was the fastest and best way to build an interface that had to be highly dynamic.

I gave two talks, one on Angular basics, and then the second one dove into my specific use case. With this information & with a knowledge of how to extend the WordPress REST API you should be able to start creating new & exciting WordPress user experiences.

It was awesome to be a part of a day full of developers explaining why they made their choice in framework. I hope this type of sharing will lead people away from “What framework should I use?” to understanding the strengths and weaknesses of each framework and make that decision on a per project basis.

In Ingot, Angular is a thin UI layer on top of what is mainly a PHP codebase. I needed a really solid AJAX interface — sorry jQuery — that would allow the interface to have lots of different UI states easily available. Angular provides that.

I want to add that while the focus of these talks was Angular, building this way, in my opinion, requires an API-first approach to the PHP code. I wrote extensively about this before. The short version is that it requires keeping the code required for reading and writing to the database totally decoupled from the front-end use, and API code.

How The WordPress REST API Changes WordPress Plugin Development

This approach also requires having your own REST API endpoints. That part of the stack I covered in a talk I gave several times last year, in chapter 8 of my book and part 3 of my course.

http://learn.joshpress.net/downloads/customizing-wordpress-rest-api/

Slides

Video

 

Example Code

Learn More

3 Replies to “Learning AngularJS For WordPress Development”

  1. This may be a stupid question, but your talking about building an admin interface for your plugin. So is this plugin used within the wordpress Admin console, or does it take you out of wordpress Admin?

    I understand the concept of building a whole new admin interface, but this is just a plugin or does it take over the whole admin?

    Im just trying to get my head around why build a new interface for admin tasks, when WP ships with its own admin which users are familiar with, and if this then throws the user into another interface they have to learn.

    Or is it a hosted system? Some screenshots of admin etc would be good and an overview of how a user might actually use this would be handy.

Leave a Reply

Your email address will not be published. Required fields are marked *