SlideShare a Scribd company logo
Introducing AngularJS
Loc Nguyen
● Java, Ruby, JavaScript, C#, PHP
● Sr Engineer at SignNow, full stack consultant
● AngularJS OC and Code for OC meetup organizer
● @locn
● lochnguyen@gmail.com
Agenda
● The single page app
● Live coding…
o Data binding
o Controllers
o Services
o Directives
● Examine an app….?
Not on Agenda
● REST integration
● Promises
● Routing
● Testing
● Angular UI
● Yeoman, Bower, Grunt, Gulp
● Integrating non-Angular libraries
● Performance gotchas* egghead.io
Thick client pains
● Tight coupling to server technologies
● Model or DOM as the truth
● Promoting maintainability
○ Responding to change
○ Ease of testing
○ Organized code
OOP}
History for hipsters
● DHTML
● Web 2.0
● Rich Internet Applications
● Ambitious web apps™
State of the MVC
The Trend of Things
(Rock) Stars
Double Jeopardy?
Web vs Desktop MVC
Model2 MVC
● Model notifies no one
● Controller pulls changes
into view with each
request
● Browser renders model
state
MVC
● Model notifies observers
● View observes models
● View reflect model state
Introducing AngularJS
Data binding in Angular*
● $scope
o application glue
o source of truth, or a view model
o provides observers for state changes
Data binding example
(Angularians plz ignore anti-patterns)
Data binding in Angular*
● $watch list
// pseudo code, implicit watchers from
example
$watchList = [
$watch('scope.tweet'),
$watch('scope.imageUrl')
]
Data binding in Angular*
● $watch function, explicit watcher
$scope.$watch(function () {
return map.currentCity;
}, function (center) {
// update OKCupid match list
});
Explicit watcher example
Data binding in Angular*
● $digest loop
o Loop through the $watch list and do a dirty check
o Keep track of new values
o Keep looping until no values have changed
o Finally, repaint DOM
● $digest triggers
o ng-events, ng built-in services, $scope.$apply()
Dependency Injection
● Reduce coupling
● Improves testability
● Promotes reusability
Dependency Injection
function travel(a, z) {
setOrigin(a);
setDest(z);
var route =
getRoute();
var car = new Car();
car.go(route);
}
travel('Irvine', 'Orange')
Dependency Injection
function travel(a, z,
transport) {
setOrigin(a);
setDest(z);
var route = getRoute();
transport.go(route);
}
travel(1985, 1955);
travel(1985, 1955, new
TimeMachine());
Controllers
● More glue between view and model
● Manage data models
● Created and destroyed with route/view
changes
Services
● Singleton objects
● Communication between controllers
● Maintain state for lifetime of app
Controller & Service
Example
Directives
The Awesome Sauce™ in AngularJS
● Good on anything
● Apply liberally
● Carry extra
Directives
● Built-in directives
○ ng-show, ng-click, ng-repeat
● Custom directives
○ reusable widgets
○ declarative programming
○ wrap non Angular libraries
Directive Examples
Mobile web app example
meetup.com/angularjs-oc meetup.com/CodeforOC
Ad

Recommended

PPTX
Up and Running with ReactJS
Loc Nguyen
 
PPTX
Dart and AngularDart
Loc Nguyen
 
PPTX
AngularJS for Java Developers
Loc Nguyen
 
PDF
Angular Promises and Advanced Routing
Alexe Bogdan
 
PDF
Angular js routing options
Nir Kaufman
 
PDF
Introduction to AJAX In WordPress
Caldera Labs
 
PPTX
AngularJS Directives
Eyal Vardi
 
PDF
Architecture, Auth, and Routing with uiRouter
Christopher Caplinger
 
PPTX
AngularJS Routing
Eyal Vardi
 
PDF
React vs-angular-mobile
Michael Haberman
 
PDF
Workshop 12: AngularJS Parte I
Visual Engineering
 
PPTX
Angularjs Basics
Anuradha Bandara
 
PDF
Workshop 13: AngularJS Parte II
Visual Engineering
 
PPTX
Practical AngularJS
Wei Ru
 
PPTX
Angular 2.0 Routing and Navigation
Eyal Vardi
 
DOCX
How routing works in angular js
codeandyou forums
 
PPTX
Upgrading from Angular 1.x to Angular 2.x
Eyal Vardi
 
PDF
The Art of AngularJS - DeRailed 2014
Matt Raible
 
PPTX
Top 10 Mistakes AngularJS Developers Make
Mark Meyer
 
PPTX
AngularJS - $http & $resource Services
Eyal Vardi
 
PPTX
Javascript first-class citizenery
toddbr
 
PDF
Workshop 22: React-Redux Middleware
Visual Engineering
 
DOCX
Understanding angular js $rootscope and $scope
Brajesh Yadav
 
PPTX
Building an End-to-End AngularJS Application
Dan Wahlin
 
PDF
Introduction to AngularJS
Jussi Pohjolainen
 
PPTX
Angularjs Anti-patterns
Steven Lambert
 
PPTX
AngularJS Beginners Workshop
Sathish VJ
 
PPTX
Angular 1.x vs. Angular 2.x
Eyal Vardi
 
PPTX
Web Components
Loc Nguyen
 
PDF
Friendzr
PPPdeluxe
 

More Related Content

What's hot (20)

PPTX
AngularJS Routing
Eyal Vardi
 
PDF
React vs-angular-mobile
Michael Haberman
 
PDF
Workshop 12: AngularJS Parte I
Visual Engineering
 
PPTX
Angularjs Basics
Anuradha Bandara
 
PDF
Workshop 13: AngularJS Parte II
Visual Engineering
 
PPTX
Practical AngularJS
Wei Ru
 
PPTX
Angular 2.0 Routing and Navigation
Eyal Vardi
 
DOCX
How routing works in angular js
codeandyou forums
 
PPTX
Upgrading from Angular 1.x to Angular 2.x
Eyal Vardi
 
PDF
The Art of AngularJS - DeRailed 2014
Matt Raible
 
PPTX
Top 10 Mistakes AngularJS Developers Make
Mark Meyer
 
PPTX
AngularJS - $http & $resource Services
Eyal Vardi
 
PPTX
Javascript first-class citizenery
toddbr
 
PDF
Workshop 22: React-Redux Middleware
Visual Engineering
 
DOCX
Understanding angular js $rootscope and $scope
Brajesh Yadav
 
PPTX
Building an End-to-End AngularJS Application
Dan Wahlin
 
PDF
Introduction to AngularJS
Jussi Pohjolainen
 
PPTX
Angularjs Anti-patterns
Steven Lambert
 
PPTX
AngularJS Beginners Workshop
Sathish VJ
 
PPTX
Angular 1.x vs. Angular 2.x
Eyal Vardi
 
AngularJS Routing
Eyal Vardi
 
React vs-angular-mobile
Michael Haberman
 
Workshop 12: AngularJS Parte I
Visual Engineering
 
Angularjs Basics
Anuradha Bandara
 
Workshop 13: AngularJS Parte II
Visual Engineering
 
Practical AngularJS
Wei Ru
 
Angular 2.0 Routing and Navigation
Eyal Vardi
 
How routing works in angular js
codeandyou forums
 
Upgrading from Angular 1.x to Angular 2.x
Eyal Vardi
 
The Art of AngularJS - DeRailed 2014
Matt Raible
 
Top 10 Mistakes AngularJS Developers Make
Mark Meyer
 
AngularJS - $http & $resource Services
Eyal Vardi
 
Javascript first-class citizenery
toddbr
 
Workshop 22: React-Redux Middleware
Visual Engineering
 
Understanding angular js $rootscope and $scope
Brajesh Yadav
 
Building an End-to-End AngularJS Application
Dan Wahlin
 
Introduction to AngularJS
Jussi Pohjolainen
 
Angularjs Anti-patterns
Steven Lambert
 
AngularJS Beginners Workshop
Sathish VJ
 
Angular 1.x vs. Angular 2.x
Eyal Vardi
 

Viewers also liked (9)

PPTX
Web Components
Loc Nguyen
 
PDF
Friendzr
PPPdeluxe
 
PPS
Pildimang1
havocc311
 
PPTX
Elementos cinematograficos anteiores a los hermanos lumiere pp
Blanquiii
 
PDF
Certificado en internet
Mesyodi
 
PPTX
Parte 1
pusuario
 
PPTX
FotografíAs
SpeaRiiNG
 
PDF
Elezioni RSU 2015
AbCisl Napoli
 
DOC
Sopa de letras con mensaje guillermo jorge manuel josé
Nelson Martinez
 
Web Components
Loc Nguyen
 
Friendzr
PPPdeluxe
 
Pildimang1
havocc311
 
Elementos cinematograficos anteiores a los hermanos lumiere pp
Blanquiii
 
Certificado en internet
Mesyodi
 
Parte 1
pusuario
 
FotografíAs
SpeaRiiNG
 
Elezioni RSU 2015
AbCisl Napoli
 
Sopa de letras con mensaje guillermo jorge manuel josé
Nelson Martinez
 
Ad

Similar to Introducing AngularJS (20)

PPTX
Angular js 1.0-fundamentals
Venkatesh Narayanan
 
PDF
AngularJS Deep Dives (NYC GDG Apr 2013)
Nitya Narasimhan
 
PDF
AngularJS: an introduction
Luigi De Russis
 
PPTX
Intro to AngularJs
SolTech, Inc.
 
PDF
AngularJS Workshop
Gianluca Cacace
 
PPTX
AngularJS One Day Workshop
Shyam Seshadri
 
PDF
Itroducing Angular JS
Carlos Emanuel Mathiasen
 
PDF
AngularJS - introduction & how it works?
Alexe Bogdan
 
PPT
introduction to Angularjs basics
Ravindra K
 
PDF
Angular.js for beginners
Basia Madej
 
PDF
[Ebooks PDF] download AngularJS 1st Edition Brad Green full chapters
kiciunonge
 
PPTX
AngularJS Introduction (Talk given on Aug 5 2013)
Abhishek Anand
 
ODP
AngularJs Crash Course
Keith Bloomfield
 
PPTX
Angular js for Beginnners
Santosh Kumar Kar
 
PPTX
AngularJs presentation
Phan Tuan
 
PPTX
ME vs WEB - AngularJS Fundamentals
Aviran Cohen
 
PDF
Download full ebook of Angularjs Brad Green Shyam Seshadri instant download pdf
mehiicniode
 
PPTX
Angular js 1.3 presentation for fed nov 2014
Sarah Hudson
 
PDF
AngularJs
Abdhesh Kumar
 
PDF
Angularjs 131211063348-phpapp01
Arunangsu Sahu
 
Angular js 1.0-fundamentals
Venkatesh Narayanan
 
AngularJS Deep Dives (NYC GDG Apr 2013)
Nitya Narasimhan
 
AngularJS: an introduction
Luigi De Russis
 
Intro to AngularJs
SolTech, Inc.
 
AngularJS Workshop
Gianluca Cacace
 
AngularJS One Day Workshop
Shyam Seshadri
 
Itroducing Angular JS
Carlos Emanuel Mathiasen
 
AngularJS - introduction & how it works?
Alexe Bogdan
 
introduction to Angularjs basics
Ravindra K
 
Angular.js for beginners
Basia Madej
 
[Ebooks PDF] download AngularJS 1st Edition Brad Green full chapters
kiciunonge
 
AngularJS Introduction (Talk given on Aug 5 2013)
Abhishek Anand
 
AngularJs Crash Course
Keith Bloomfield
 
Angular js for Beginnners
Santosh Kumar Kar
 
AngularJs presentation
Phan Tuan
 
ME vs WEB - AngularJS Fundamentals
Aviran Cohen
 
Download full ebook of Angularjs Brad Green Shyam Seshadri instant download pdf
mehiicniode
 
Angular js 1.3 presentation for fed nov 2014
Sarah Hudson
 
AngularJs
Abdhesh Kumar
 
Angularjs 131211063348-phpapp01
Arunangsu Sahu
 
Ad

Recently uploaded (20)

PPTX
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
moonsony54
 
PDF
Structured Programming with C++ :: Kjell Backman
Shabista Imam
 
PPTX
Deep Learning for Image Processing on 16 June 2025 MITS.pptx
resming1
 
PDF
International Journal of Advanced Information Technology (IJAIT)
ijait
 
PDF
System design handwritten notes guidance
Shabista Imam
 
PPTX
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
PDF
Complete University of Calculus :: 2nd edition
Shabista Imam
 
PDF
輪読会資料_Miipher and Miipher2 .
NABLAS株式会社
 
PPTX
AI_Presentation (1). Artificial intelligence
RoselynKaur8thD34
 
PPTX
NEW Strengthened Senior High School Gen Math.pptx
DaryllWhere
 
PPTX
Kel.3_A_Review_on_Internet_of_Things_for_Defense_v3.pptx
Endang Saefullah
 
PPT
20CE404-Soil Mechanics - Slide Share PPT
saravananr808639
 
PPTX
Bitumen Emulsion by Dr Sangita Ex CRRI Delhi
grilcodes
 
PDF
Rapid Prototyping for XR: Lecture 3 - Video and Paper Prototyping
Mark Billinghurst
 
PPTX
Introduction to Python Programming Language
merlinjohnsy
 
PDF
Rapid Prototyping for XR: Lecture 5 - Cross Platform Development
Mark Billinghurst
 
PPTX
Structural Wonderers_new and ancient.pptx
nikopapa113
 
PDF
FUNDAMENTALS OF COMPUTER ORGANIZATION AND ARCHITECTURE
Shabista Imam
 
PPTX
Industrial internet of things IOT Week-3.pptx
KNaveenKumarECE
 
PDF
FSE-Journal-First-Automated code editing with search-generate-modify.pdf
cl144
 
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
moonsony54
 
Structured Programming with C++ :: Kjell Backman
Shabista Imam
 
Deep Learning for Image Processing on 16 June 2025 MITS.pptx
resming1
 
International Journal of Advanced Information Technology (IJAIT)
ijait
 
System design handwritten notes guidance
Shabista Imam
 
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
Complete University of Calculus :: 2nd edition
Shabista Imam
 
輪読会資料_Miipher and Miipher2 .
NABLAS株式会社
 
AI_Presentation (1). Artificial intelligence
RoselynKaur8thD34
 
NEW Strengthened Senior High School Gen Math.pptx
DaryllWhere
 
Kel.3_A_Review_on_Internet_of_Things_for_Defense_v3.pptx
Endang Saefullah
 
20CE404-Soil Mechanics - Slide Share PPT
saravananr808639
 
Bitumen Emulsion by Dr Sangita Ex CRRI Delhi
grilcodes
 
Rapid Prototyping for XR: Lecture 3 - Video and Paper Prototyping
Mark Billinghurst
 
Introduction to Python Programming Language
merlinjohnsy
 
Rapid Prototyping for XR: Lecture 5 - Cross Platform Development
Mark Billinghurst
 
Structural Wonderers_new and ancient.pptx
nikopapa113
 
FUNDAMENTALS OF COMPUTER ORGANIZATION AND ARCHITECTURE
Shabista Imam
 
Industrial internet of things IOT Week-3.pptx
KNaveenKumarECE
 
FSE-Journal-First-Automated code editing with search-generate-modify.pdf
cl144
 

Introducing AngularJS

Editor's Notes

  • #3: Polyglot dev. Most of my career on the server side b/c I hated JavaScript, the DOM, spaghetti Full stack engineer at SignNow. Technical lead of the API and web team
  • #5: Kitchen sink
  • #6: Massaging data the fit into a rendered view Passing arbitrary data into the view to configure JS functions, CSS Controllers know a little too much about our browser Friction between back and front end devs in the Controller - Where do you store state, where do you read state? Imagine keeping multiple widgets that change the same mode in sync can be a nightmare. - Why I hated front-end development
  • #11: This is partly true. You’re not learning two different MVCs but two architectures that serve two different purposes. Somewhere in internet history the two became conflated.
  • #12: Model2 is great for organizing spaghetti code on the server > Struts, Rails, Django, ASP.NET MVC Web 2.0 and RIA happened. GMail, Ajax-y apps Consider how complex the task of keeping a view in synch with model state
  • #14: Start off with the key concept in Angular, magic happens on it $scope is the glue between the view and the controller. $scope is the data model, or the source of truth. It’s pretty much a view model.
  • #16: Every binding on the view implicitly adds an watcher in the $watch list
  • #17: $scope is the glue between the view and the controller. $scope is the data model, or the source of truth. It’s pretty much a view model.
  • #20: These are just good OOP principles and DI facilitates adherence.
  • #21: Function is tightly coupled to Car. Hard to test because it won’t execute unless Car function is available. Can’t swap out with a mock for testing. Not reusable, only works whenever you want to travel with an ugly car. Forces you to write a new travel function to accomplish the same thing
  • #22: Left side is tightly coupled to Car function Hard to test because it won’t execute unless Car function is available.
  • #23: Already mentioned while going over Angular scopes Typical use case is to read a query parameter and and query an API to update the view > or respond to form submit by validating the form and delegating submission to a service objet
  • #26: Encapsulates behavior or a set of instructions so you can apply them to the DOM
  • #28: Show image drop
  • #29: Show image drop