SlideShare a Scribd company logo
Introduction To
AngularJS For
WordPress
Developers
Josh Pollock
@Josh412
JoshPress.net/wordcamp-miami-angularjs
Why Not X?
React, Backbone, Ember, Etc...
MVC
Part One
MVC
● Model
● View
● Controller
MVC
Model
The model is the current set of
data, defined by the controller,
displayed by the view.
MVC
View
● The visual representation of
the data.
● In Angular this is an HTML
file.
MVC
Controller
● Keeps the models up-to-
date using the remote API.
● Updates the model based on
your interactions with the
view.
MVC
Bindings
Part Two
Bindings
● Connects views to
controllers.
● HTML5 Attributes
● Template Tags: Curly
Brackets
<div ng-controller="postExample">
<form>
<input type="text" ng-model="post.title" />
</form>
<div>{{post.title}}</div>
</div>
Controller
Bindings
● Use controller function to
create controller...
● $scope is available in view
(function(angular) {
'use strict';
angular.module('learnAngular', [])
.controller('postExample', ['$scope', function
($scope) {
$scope.post = {
title: 'Enter Title'
};
}]);
})(window.angular);
Template
Bindings
● Bindings can be used to call
functions
● Examples:
○ ng-submit
○ ng-hide
<div ng-controller="postExample">
<form ng-submit="submit()">
<input type="text" ng-model="post.title" />
<input type="submit" value="Save" ng-hide="
post.title == 'Enter Title'" />
</form>
<div>{{post.title}}</div>
</div>
Views
Bindings
● Define functions for view on
$scope.
● Example: $scope.submit
(function(angular) {
'use strict';
angular.module('learnAngular', [])
.controller('postExample', ['$scope',
function($scope) {
$scope.post = {
title: 'Enter Title'
};
$scope.submit = function(){
alert( 'saving' );
}
}]);
})(window.angular);
Controller
Bindings
● ng-repeat:
○ Repeat items (like a list
of posts)
<div ng-controller="postsExample">
<h3>Posts:</h3>
<div ng-repeat="post in posts">
{{post.title}}
</div>
</div>
Views
Bindings
● Look mom, two controllers!
● Iterating over posts array.
(function(angular) {
'use strict';
angular.module('learnAngular', [])
.controller('postExample', ['$scope', function
($scope) {
$scope.post = {
title: 'Enter Title'
};
$scope.submit = function(){
alert( 'saving' );
}
}]).controller('postsExample', ['$scope',
function($scope) {
$scope.posts = [
{ title: 'Post One' },
{ title: 'Post Two' }
];
}]);
})(window.angular);
Controller
HTTP
Part Three
Angular HTTP
● Use to connect model to
remote API
● Syntax similar to jQuery
AJAX
(function(angular) {
'use strict';
angular.module('learnAngular', [])
.controller('postExample', ['$scope', '$http',
function($scope, $http) {
$http({
url: 'http://joshpress.net/wp-
json/wp/v2/posts/1',
cache: true
} ).then( function( res ) {
$scope.post = res.data;
});
}]).controller('postsExample', ['$scope', '$http',
function($scope, $http) {
$http( {
url: 'http://joshpress.net/wp-
json/wp/v2/posts/',
cache: true
} ).then( function ( res ) {
$scope.posts = res.data;
$scope.totalPages = res.headers('x-wp-
totalpages');
$scope.total = res.headers( 'x-wp-total' );
} );
}]);
})(window.angular);
Angular HTTP
● Supports all methods
○ IE Use POST to save
● Caching… promises.. etc.
(function(angular) {
'use strict';
angular.module('learnAngular', [])
.controller('postExample', ['$scope', '$http',
function($scope, $http) {
$http({
url: 'http://joshpress.net/wp-
json/wp/v2/posts/1',
cache: true
} ).then( function( res ) {
$scope.post = res.data;
});
}]).controller('postsExample', ['$scope', '$http',
function($scope, $http) {
$http( {
url: 'http://joshpress.net/wp-
json/wp/v2/posts/',
cache: true
} ).then( function ( res ) {
$scope.posts = res.data;
$scope.totalPages = res.headers('x-wp-
totalpages');
$scope.total = res.headers( 'x-wp-total' );
} );
}]);
})(window.angular);
Angular HTTP
● Use to connect model to
remote API
● Syntax similar to jQuery
AJAX
(function(angular) {
'use strict';
angular.module('learnAngular', [])
.controller('postExample', ['$scope', '$http',
function($scope, $http) {
$http({
url: 'http://joshpress.net/wp-
json/wp/v2/posts/1',
cache: true
} ).then( function( res ) {
$scope.post = res.data;
});
$scope.save = function(){
$http({
url: 'http://joshpress.net/wp-
json/wp/v2/posts/1',
cache: true,
method: "POST"
} ).then( function( res ) {
$scope.post = res.data;
});
};
}]);
})(window.angular);
Go Further
Part Next
Building Apps With REST API + AngularJS
Customizing The API
Your app likely needs custom routes
or to customize the defaults
● Slides, Video Of
Talk
● More information
Single Page Web Apps As
WordPress Admin
Interfaces Using AngularJS
& The WordPress REST
API
● 3PM Today:)
● Slides
CalderaWP.com
IngotHQ.com
@Josh412
JoshPress.net

More Related Content

PDF
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Caldera Labs
 
PDF
Caldera Learn - LoopConf WP API + Angular FTW Workshop
CalderaLearn
 
PDF
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
Caldera Labs
 
PDF
Introduction to AJAX In WordPress
Caldera Labs
 
PDF
Using the new WordPress REST API
Caldera Labs
 
PDF
Extending the WordPress REST API - Josh Pollock
Caldera Labs
 
PPTX
Webinar: AngularJS and the WordPress REST API
WP Engine UK
 
ODP
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
vvaswani
 
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Caldera Labs
 
Caldera Learn - LoopConf WP API + Angular FTW Workshop
CalderaLearn
 
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
Caldera Labs
 
Introduction to AJAX In WordPress
Caldera Labs
 
Using the new WordPress REST API
Caldera Labs
 
Extending the WordPress REST API - Josh Pollock
Caldera Labs
 
Webinar: AngularJS and the WordPress REST API
WP Engine UK
 
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
vvaswani
 

What's hot (20)

PPTX
Dart and AngularDart
Loc Nguyen
 
PPTX
AngularJS for Java Developers
Loc Nguyen
 
PDF
AngularJS with Slim PHP Micro Framework
Backand Cohen
 
KEY
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Paulo Ragonha
 
PDF
Workshop 12: AngularJS Parte I
Visual Engineering
 
PDF
Introduction to plugin development
Caldera Labs
 
PDF
Bullet: The Functional PHP Micro-Framework
Vance Lucas
 
PDF
Keeping it Small: Getting to know the Slim Micro Framework
Jeremy Kendall
 
PDF
REST in AngularJS
a_sharif
 
PPTX
AngularJS Directives
Eyal Vardi
 
PDF
Head First Zend Framework - Part 1 Project & Application
Jace Ju
 
PDF
Developing apps using Perl
Anatoly Sharifulin
 
PPTX
Zend framework
Prem Shankar
 
PDF
Workshop 14: AngularJS Parte III
Visual Engineering
 
PPT
Slim RedBeanPHP and Knockout
Vic Metcalfe
 
PDF
Rails 3: Dashing to the Finish
Yehuda Katz
 
PDF
Codeigniter : Two Step View - Concept Implementation
Abdul Malik Ikhsan
 
PPTX
Javascript first-class citizenery
toddbr
 
PDF
Bootstrat REST APIs with Laravel 5
Elena Kolevska
 
PDF
Workshop 4: NodeJS. Express Framework & MongoDB.
Visual Engineering
 
Dart and AngularDart
Loc Nguyen
 
AngularJS for Java Developers
Loc Nguyen
 
AngularJS with Slim PHP Micro Framework
Backand Cohen
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Paulo Ragonha
 
Workshop 12: AngularJS Parte I
Visual Engineering
 
Introduction to plugin development
Caldera Labs
 
Bullet: The Functional PHP Micro-Framework
Vance Lucas
 
Keeping it Small: Getting to know the Slim Micro Framework
Jeremy Kendall
 
REST in AngularJS
a_sharif
 
AngularJS Directives
Eyal Vardi
 
Head First Zend Framework - Part 1 Project & Application
Jace Ju
 
Developing apps using Perl
Anatoly Sharifulin
 
Zend framework
Prem Shankar
 
Workshop 14: AngularJS Parte III
Visual Engineering
 
Slim RedBeanPHP and Knockout
Vic Metcalfe
 
Rails 3: Dashing to the Finish
Yehuda Katz
 
Codeigniter : Two Step View - Concept Implementation
Abdul Malik Ikhsan
 
Javascript first-class citizenery
toddbr
 
Bootstrat REST APIs with Laravel 5
Elena Kolevska
 
Workshop 4: NodeJS. Express Framework & MongoDB.
Visual Engineering
 
Ad

Similar to Introduction to AngularJS For WordPress Developers (20)

PPTX
Webinar: AngularJS and the WordPress REST API
WP Engine
 
PPTX
Angular js for Beginnners
Santosh Kumar Kar
 
PPTX
Training On Angular Js
Mahima Radhakrishnan
 
PPTX
Intro to AngularJs
SolTech, Inc.
 
PPTX
Angular js 1.3 presentation for fed nov 2014
Sarah Hudson
 
DOCX
Angular js getting started
Hemant Mali
 
PPT
Introduction to AngularJS
Anass90
 
PPT
Angular js
Hritesh Saha
 
PDF
AngularJS: an introduction
Luigi De Russis
 
PPTX
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
 
PPTX
Intoduction to Angularjs
Gaurav Agrawal
 
PPT
Angular js
yogi_solanki
 
PPTX
Angular js 1.0-fundamentals
Venkatesh Narayanan
 
PPTX
ME vs WEB - AngularJS Fundamentals
Aviran Cohen
 
PDF
AngularJS Deep Dives (NYC GDG Apr 2013)
Nitya Narasimhan
 
PDF
One Weekend With AngularJS
Yashobanta Bai
 
PDF
Wt unit 5 client &amp; server side framework
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
 
PPTX
Angular JS, steal the idea
Scott Lee
 
PDF
Angularjs
Ynon Perek
 
PDF
Integrating AngularJS into the Campus CMS
Tom Borger
 
Webinar: AngularJS and the WordPress REST API
WP Engine
 
Angular js for Beginnners
Santosh Kumar Kar
 
Training On Angular Js
Mahima Radhakrishnan
 
Intro to AngularJs
SolTech, Inc.
 
Angular js 1.3 presentation for fed nov 2014
Sarah Hudson
 
Angular js getting started
Hemant Mali
 
Introduction to AngularJS
Anass90
 
Angular js
Hritesh Saha
 
AngularJS: an introduction
Luigi De Russis
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
 
Intoduction to Angularjs
Gaurav Agrawal
 
Angular js
yogi_solanki
 
Angular js 1.0-fundamentals
Venkatesh Narayanan
 
ME vs WEB - AngularJS Fundamentals
Aviran Cohen
 
AngularJS Deep Dives (NYC GDG Apr 2013)
Nitya Narasimhan
 
One Weekend With AngularJS
Yashobanta Bai
 
Wt unit 5 client &amp; server side framework
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
 
Angular JS, steal the idea
Scott Lee
 
Angularjs
Ynon Perek
 
Integrating AngularJS into the Campus CMS
Tom Borger
 
Ad

More from Caldera Labs (14)

PDF
Slightly Advanced Topics in Gutenberg Development
Caldera Labs
 
PDF
Financial Forecasting For WordPress Businesses
Caldera Labs
 
PDF
Five Attitudes Stopping You From Building Accessible Wordpress Websites
Caldera Labs
 
PDF
Our Hybrid Future: WordPress As Part of the Stack #WCNYC
Caldera Labs
 
PDF
Our Hybrid Future: WordPress As Part of the Stack
Caldera Labs
 
PDF
Introduction to VueJS & The WordPress REST API
Caldera Labs
 
PDF
It all starts with a story
Caldera Labs
 
PDF
A/B Testing FTW
Caldera Labs
 
PDF
Five events in the life of every WordPress request you should know
Caldera Labs
 
PDF
WPSessions Composer for WordPress Plugin Development
Caldera Labs
 
PDF
Josh Pollock #wcatl using composer to increase your word press development po...
Caldera Labs
 
PDF
Content Marketing With WordPress -- Tallahassee WordPress Meetup
Caldera Labs
 
PDF
Writing About WordPress: Helping Yourself, by Helping Others -- WordCamp Orl...
Caldera Labs
 
PDF
WordPress Tallahassee Meetup: Turning WordPress Sites Into Web & Mobile Apps
Caldera Labs
 
Slightly Advanced Topics in Gutenberg Development
Caldera Labs
 
Financial Forecasting For WordPress Businesses
Caldera Labs
 
Five Attitudes Stopping You From Building Accessible Wordpress Websites
Caldera Labs
 
Our Hybrid Future: WordPress As Part of the Stack #WCNYC
Caldera Labs
 
Our Hybrid Future: WordPress As Part of the Stack
Caldera Labs
 
Introduction to VueJS & The WordPress REST API
Caldera Labs
 
It all starts with a story
Caldera Labs
 
A/B Testing FTW
Caldera Labs
 
Five events in the life of every WordPress request you should know
Caldera Labs
 
WPSessions Composer for WordPress Plugin Development
Caldera Labs
 
Josh Pollock #wcatl using composer to increase your word press development po...
Caldera Labs
 
Content Marketing With WordPress -- Tallahassee WordPress Meetup
Caldera Labs
 
Writing About WordPress: Helping Yourself, by Helping Others -- WordCamp Orl...
Caldera Labs
 
WordPress Tallahassee Meetup: Turning WordPress Sites Into Web & Mobile Apps
Caldera Labs
 

Recently uploaded (20)

PDF
Data Protection & Resilience in Focus.pdf
AmyPoblete3
 
PDF
Cybersecurity Awareness Presentation ppt.
banodhaharshita
 
PPTX
Parallel & Concurrent ...
yashpavasiya892
 
PDF
PDF document: World Game (s) Great Redesign.pdf
Steven McGee
 
PPTX
Unlocking Hope : How Crypto Recovery Services Can Reclaim Your Lost Funds
lionsgate network
 
PDF
UI/UX Developer Guide: Tools, Trends, and Tips for 2025
Penguin peak
 
PPT
Introduction to dns domain name syst.ppt
MUHAMMADKAVISHSHABAN
 
PPTX
Generics jehfkhkshfhskjghkshhhhlshluhueheuhuhhlhkhk.pptx
yashpavasiya892
 
PDF
LB# 820-1889_051-7370_C000.schematic.pdf
matheusalbuquerqueco3
 
PPTX
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
PPTX
How tech helps people in the modern era.
upadhyayaryan154
 
PPTX
Pengenalan perangkat Jaringan komputer pada teknik jaringan komputer dan tele...
Prayudha3
 
PPTX
办理方法西班牙假毕业证蒙德拉贡大学成绩单MULetter文凭样本
xxxihn4u
 
PDF
KIPER4D situs Exclusive Game dari server Star Gaming Asia
hokimamad0
 
PDF
DNSSEC Made Easy, presented at PHNOG 2025
APNIC
 
PPTX
Different Generation Of Computers .pptx
divcoder9507
 
PPTX
Microsoft PowerPoint Student PPT slides.pptx
Garleys Putin
 
PPTX
谢尔丹学院毕业证购买|Sheridan文凭不见了怎么办谢尔丹学院成绩单
mookxk3
 
PPTX
Perkembangan Perangkat jaringan komputer dan telekomunikasi 3.pptx
Prayudha3
 
PPTX
Google SGE SEO: 5 Critical Changes That Could Wreck Your Rankings in 2025
Reversed Out Creative
 
Data Protection & Resilience in Focus.pdf
AmyPoblete3
 
Cybersecurity Awareness Presentation ppt.
banodhaharshita
 
Parallel & Concurrent ...
yashpavasiya892
 
PDF document: World Game (s) Great Redesign.pdf
Steven McGee
 
Unlocking Hope : How Crypto Recovery Services Can Reclaim Your Lost Funds
lionsgate network
 
UI/UX Developer Guide: Tools, Trends, and Tips for 2025
Penguin peak
 
Introduction to dns domain name syst.ppt
MUHAMMADKAVISHSHABAN
 
Generics jehfkhkshfhskjghkshhhhlshluhueheuhuhhlhkhk.pptx
yashpavasiya892
 
LB# 820-1889_051-7370_C000.schematic.pdf
matheusalbuquerqueco3
 
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
How tech helps people in the modern era.
upadhyayaryan154
 
Pengenalan perangkat Jaringan komputer pada teknik jaringan komputer dan tele...
Prayudha3
 
办理方法西班牙假毕业证蒙德拉贡大学成绩单MULetter文凭样本
xxxihn4u
 
KIPER4D situs Exclusive Game dari server Star Gaming Asia
hokimamad0
 
DNSSEC Made Easy, presented at PHNOG 2025
APNIC
 
Different Generation Of Computers .pptx
divcoder9507
 
Microsoft PowerPoint Student PPT slides.pptx
Garleys Putin
 
谢尔丹学院毕业证购买|Sheridan文凭不见了怎么办谢尔丹学院成绩单
mookxk3
 
Perkembangan Perangkat jaringan komputer dan telekomunikasi 3.pptx
Prayudha3
 
Google SGE SEO: 5 Critical Changes That Could Wreck Your Rankings in 2025
Reversed Out Creative
 

Introduction to AngularJS For WordPress Developers

  • 4. Why Not X? React, Backbone, Ember, Etc...
  • 6. MVC ● Model ● View ● Controller MVC
  • 7. Model The model is the current set of data, defined by the controller, displayed by the view. MVC
  • 8. View ● The visual representation of the data. ● In Angular this is an HTML file. MVC
  • 9. Controller ● Keeps the models up-to- date using the remote API. ● Updates the model based on your interactions with the view. MVC
  • 11. Bindings ● Connects views to controllers. ● HTML5 Attributes ● Template Tags: Curly Brackets <div ng-controller="postExample"> <form> <input type="text" ng-model="post.title" /> </form> <div>{{post.title}}</div> </div> Controller
  • 12. Bindings ● Use controller function to create controller... ● $scope is available in view (function(angular) { 'use strict'; angular.module('learnAngular', []) .controller('postExample', ['$scope', function ($scope) { $scope.post = { title: 'Enter Title' }; }]); })(window.angular); Template
  • 13. Bindings ● Bindings can be used to call functions ● Examples: ○ ng-submit ○ ng-hide <div ng-controller="postExample"> <form ng-submit="submit()"> <input type="text" ng-model="post.title" /> <input type="submit" value="Save" ng-hide=" post.title == 'Enter Title'" /> </form> <div>{{post.title}}</div> </div> Views
  • 14. Bindings ● Define functions for view on $scope. ● Example: $scope.submit (function(angular) { 'use strict'; angular.module('learnAngular', []) .controller('postExample', ['$scope', function($scope) { $scope.post = { title: 'Enter Title' }; $scope.submit = function(){ alert( 'saving' ); } }]); })(window.angular); Controller
  • 15. Bindings ● ng-repeat: ○ Repeat items (like a list of posts) <div ng-controller="postsExample"> <h3>Posts:</h3> <div ng-repeat="post in posts"> {{post.title}} </div> </div> Views
  • 16. Bindings ● Look mom, two controllers! ● Iterating over posts array. (function(angular) { 'use strict'; angular.module('learnAngular', []) .controller('postExample', ['$scope', function ($scope) { $scope.post = { title: 'Enter Title' }; $scope.submit = function(){ alert( 'saving' ); } }]).controller('postsExample', ['$scope', function($scope) { $scope.posts = [ { title: 'Post One' }, { title: 'Post Two' } ]; }]); })(window.angular); Controller
  • 18. Angular HTTP ● Use to connect model to remote API ● Syntax similar to jQuery AJAX (function(angular) { 'use strict'; angular.module('learnAngular', []) .controller('postExample', ['$scope', '$http', function($scope, $http) { $http({ url: 'http://joshpress.net/wp- json/wp/v2/posts/1', cache: true } ).then( function( res ) { $scope.post = res.data; }); }]).controller('postsExample', ['$scope', '$http', function($scope, $http) { $http( { url: 'http://joshpress.net/wp- json/wp/v2/posts/', cache: true } ).then( function ( res ) { $scope.posts = res.data; $scope.totalPages = res.headers('x-wp- totalpages'); $scope.total = res.headers( 'x-wp-total' ); } ); }]); })(window.angular);
  • 19. Angular HTTP ● Supports all methods ○ IE Use POST to save ● Caching… promises.. etc. (function(angular) { 'use strict'; angular.module('learnAngular', []) .controller('postExample', ['$scope', '$http', function($scope, $http) { $http({ url: 'http://joshpress.net/wp- json/wp/v2/posts/1', cache: true } ).then( function( res ) { $scope.post = res.data; }); }]).controller('postsExample', ['$scope', '$http', function($scope, $http) { $http( { url: 'http://joshpress.net/wp- json/wp/v2/posts/', cache: true } ).then( function ( res ) { $scope.posts = res.data; $scope.totalPages = res.headers('x-wp- totalpages'); $scope.total = res.headers( 'x-wp-total' ); } ); }]); })(window.angular);
  • 20. Angular HTTP ● Use to connect model to remote API ● Syntax similar to jQuery AJAX (function(angular) { 'use strict'; angular.module('learnAngular', []) .controller('postExample', ['$scope', '$http', function($scope, $http) { $http({ url: 'http://joshpress.net/wp- json/wp/v2/posts/1', cache: true } ).then( function( res ) { $scope.post = res.data; }); $scope.save = function(){ $http({ url: 'http://joshpress.net/wp- json/wp/v2/posts/1', cache: true, method: "POST" } ).then( function( res ) { $scope.post = res.data; }); }; }]); })(window.angular);
  • 22. Building Apps With REST API + AngularJS Customizing The API Your app likely needs custom routes or to customize the defaults ● Slides, Video Of Talk ● More information Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The WordPress REST API ● 3PM Today:) ● Slides