SlideShare a Scribd company logo
The AngularJS way 
Boyan Mihaylov, Ebita
Agenda 
• Why AngularJS? 
• Hello, world 
• How does it work? 
• Foundation: the basic components 
• Real-case scenario development 
2
3
Why AngularJS? 
• Need to handle complex clients 
• jQuery is too low-level 
• MV* pattern on the client 
• No DOM operations 
• Data models are POJO 
• Huge community 
• 64 920+ questions on Stack Overflow 
• 11 701+ questions on Google Groups 
4
Hello, World! 
Text editor 
Browser 
directives 
data binding 
5
Bootstrapping 
<html ng-app> 
<body> 
{{expression}} 
</body> 
</html> 
Root 
scope 
Template Model 
6
Scopes 
• The glue between the view and the controller 
• A tree structure of objects 
• One root scope created per application 
• Every new scope is created from an existing one 
• Created automatically by AngularJS 
• Default creation is by prototypically inheritance 
7
Scopes: prototypical inheritance 
$rootScope 
.say = function() { … }; 
$scopeA $scopeB 
$scopeB1 
.hey = function() { … }; 
8
How does it work? 
1. Trigger key press event 
2. Call $scope.$apply(“name = ‘Wo’”) 
3. Call $scope.$digest() 
1. Check for dirty items in the 
watch list 
2. Repeat until there are no dirty 
items, max 10 times 
4. Make the browser repaint the 
bound regions 
9
Foundation 
10
Modules (1) 
• Module-first approach 
• Separation of concerns 
• Plug and play 
• Dependencies 
11
Modules (2) 
Pointer to the module Module name An array with 
possible dependencies 
Retrieve a module 
by its name 
12
Modules (3) 
• ng-app may contain the name of the main application module 
Must refer to 
an existing module 
Defines a module 
13
Modules (4) 
• Two phases when initializing a module 
Module 
.config(…) .run(…) 
.config(…) .run(…) 
Configure the 
services before 
they are used. 
Services can be 
used here and 
cannot be 
reconfigured 
anymore 
14
Modules (5) 
• Modules can further define other components 
.controller(…) .directive(…) .filter(…) .factory(…) 
.service(…) 
.provider(…) 
.value(…) 
.constant(…) 
Module 
.controller(…) .directive(…) .filter(…) .factory(…) 
.service(…) 
.provider(…) 
.value(…) 
.constant(…) 
15
Controllers 
• Contain application-specific logic 
• Communicate with services 
• Should NOT manipulate the DOM 
• Assigned via ng-controller 
• Has own scope 
• Can have dependencies 
16
Dependency injection 
• Names define the instances to be injected 
• Implicit annotation 
17 
• Inline array annotation 
Can be renamed 
during minimization
Directives 
• Encapsulate component logic 
• Have access to the HTML element 
• Can have own scope (or reuse parent’s one) 
• Can have dependencies 
18
Directive attachment 
Attribute 
CSS Class 
19 
HTML element 
Comment
Built-in directives 
• ng-app – creates and initializes an AngularJS application 
• ng-model – associates a model with an input field 
• ng-click – executes a function when the user clicks on an element 
• ng-show – shows or hides an element based on an expression 
• ng-repeat – repeats a HTML element for a given input array of models 
20
Filters 
• Formats the value of an expression 
• Used in binding expressions – {{ expression | myFilter }} 
• Chaining of multiple filters – {{ expression | filter1 | filter2 }} 
• Can also be injected in controllers and directives 
21
Services 
• Contain your client-side business logic 
• Lazy initialized 
• Singletons 
• 5 types 
• Provider 
• Service 
• Factory 
• Value 
• Constant 
22
Services: provider (1) 
• The core service 
• The others are just syntactic sugar on top of it 
• Implements the factory method design pattern 
23
Services: provider (2) 
• Must provide a $get method that returns the service instance 
• Can contain dependencies 
• Can be configured during the configure phase 
• Injected as configurable providers during the configure phase 
• Injected as service instances elsewhere 
24
Services: factory and service 
• Can contain dependencies 
• Bigger control over the 
instance initialization 
• You get the value, returned 
from the provided function 
• Can contain dependencies 
• Produces a service by 
invoking a constructor with 
the new operator 
• You get a new instance of 
the provided function 
25
Services: value and constant 
• Cannot contain dependencies 
• Values are the simplest services 
• Their values can be changed 
• Constants can be injected during the configuration phase 
• Their values cannot be changed once assigned 
26
Let’s get our hands dirty 
27 
https://github.com/omeganet/The-Book-Rat/
Q&A 
28
Thank you! 
Boyan Mihaylov 
bm@ebita.dk

More Related Content

PPTX
Introduction to Angularjs
PPTX
Angular JS - Introduction
PDF
Advanced Tips & Tricks for using Angular JS
PDF
AngularJS introduction
PDF
AngularJS Basic Training
PPTX
Angular js
PPTX
Practical AngularJS
PDF
Introduction to AngularJS
Introduction to Angularjs
Angular JS - Introduction
Advanced Tips & Tricks for using Angular JS
AngularJS introduction
AngularJS Basic Training
Angular js
Practical AngularJS
Introduction to AngularJS

What's hot (20)

KEY
AngularJS for designers and developers
PDF
AngularJS: an introduction
PDF
Angularjs architecture
PPTX
Angular js
PPTX
AngularJS Beginners Workshop
PPTX
AngularJS in 60ish Minutes
PPTX
AngularJS Best Practices
PPTX
AngularJS intro
PPTX
Angular js architecture (v1.4.8)
PDF
AngularJS 101 - Everything you need to know to get started
PDF
Introduction of angular js
PPTX
5 angularjs features
PDF
AngularJS Framework
PPTX
Angular JS
PPTX
Angular js
PDF
AngularJS - What is it & Why is it awesome ? (with demos)
PPTX
Why angular js Framework
PPTX
Getting Started with Angular JS
PDF
AngularJS application architecture
PPTX
Understanding angular js
AngularJS for designers and developers
AngularJS: an introduction
Angularjs architecture
Angular js
AngularJS Beginners Workshop
AngularJS in 60ish Minutes
AngularJS Best Practices
AngularJS intro
Angular js architecture (v1.4.8)
AngularJS 101 - Everything you need to know to get started
Introduction of angular js
5 angularjs features
AngularJS Framework
Angular JS
Angular js
AngularJS - What is it & Why is it awesome ? (with demos)
Why angular js Framework
Getting Started with Angular JS
AngularJS application architecture
Understanding angular js
Ad

Viewers also liked (18)

PPTX
Benefits of developing single page web applications using angular js
PPTX
AngularJS Architecture
PDF
Stop the internet, i want to go offline
PPTX
A different thought AngularJS
PDF
Requirements Bazaar powered by AngularJS and Polymer - Talk at Google Develop...
PDF
PPTX
SharePoint Saturday Paris 2016 - AngularJS with the Microsoft Graph
PPTX
Single page application
PPT
Let your website a ride of AngularJS
PPTX
AngularJS
PDF
Angular js
PDF
Gettings started with the superheroic JavaScript library AngularJS
PPTX
Single Page Application (SPA) using AngularJS
PPTX
Angular 2 Architecture
PDF
Angular 2 for Java Developers
PPTX
Benefits of developing a Single Page Web Applications using AngularJS
PDF
The Art of AngularJS in 2015
Benefits of developing single page web applications using angular js
AngularJS Architecture
Stop the internet, i want to go offline
A different thought AngularJS
Requirements Bazaar powered by AngularJS and Polymer - Talk at Google Develop...
SharePoint Saturday Paris 2016 - AngularJS with the Microsoft Graph
Single page application
Let your website a ride of AngularJS
AngularJS
Angular js
Gettings started with the superheroic JavaScript library AngularJS
Single Page Application (SPA) using AngularJS
Angular 2 Architecture
Angular 2 for Java Developers
Benefits of developing a Single Page Web Applications using AngularJS
The Art of AngularJS in 2015
Ad

Similar to The AngularJS way (20)

PDF
AngularJS Workshop
PDF
Angular basicschat
PPTX
Angular js 1.0-fundamentals
PPT
Getting started with angular js
PDF
Everything You Need To Know About AngularJS
PDF
Introduction to AngularJS
PPTX
Learning AngularJS - Complete coverage of AngularJS features and concepts
PPTX
Angular workshop - Full Development Guide
PDF
AngularJS - TechTalk 3/2/2014
PPT
Getting started with angular js
PPTX
Angular Presentation
PPT
Coffee@DBG - Exploring Angular JS
ODP
Angular js-crash-course
PPTX
AngularJS = Browser applications on steroids
PPTX
Intro to AngularJs
ODP
AngularJs Crash Course
PPTX
ME vs WEB - AngularJS Fundamentals
PPTX
angularJs Workshop
AngularJS Workshop
Angular basicschat
Angular js 1.0-fundamentals
Getting started with angular js
Everything You Need To Know About AngularJS
Introduction to AngularJS
Learning AngularJS - Complete coverage of AngularJS features and concepts
Angular workshop - Full Development Guide
AngularJS - TechTalk 3/2/2014
Getting started with angular js
Angular Presentation
Coffee@DBG - Exploring Angular JS
Angular js-crash-course
AngularJS = Browser applications on steroids
Intro to AngularJs
AngularJs Crash Course
ME vs WEB - AngularJS Fundamentals
angularJs Workshop

More from Boyan Mihaylov (16)

PDF
How WebAssembly is changing the Web and what it means for Angular
PDF
Crafting a robust deployment pipeline in finance
PDF
Using improv techniques for better agile teams
PDF
Web assembly brings the web to a new era
PDF
Showdown CI/CD - TeamCity
PPTX
Shifting to agile
PDF
Is WebAssembly the killer of JavaScript?
PDF
Lean or agile, software architecture is fragile
PPTX
Software architecture also needs agile
PPTX
Flux architecture
PPTX
AngularJS 2.0
PPTX
To SPA or not to SPA
PPTX
Agile software architecture
PPTX
Component-driven development with AngularJS
PPTX
Bringing the light to the client with KnockoutJS
PPTX
Identifying methods for measuring emotions
How WebAssembly is changing the Web and what it means for Angular
Crafting a robust deployment pipeline in finance
Using improv techniques for better agile teams
Web assembly brings the web to a new era
Showdown CI/CD - TeamCity
Shifting to agile
Is WebAssembly the killer of JavaScript?
Lean or agile, software architecture is fragile
Software architecture also needs agile
Flux architecture
AngularJS 2.0
To SPA or not to SPA
Agile software architecture
Component-driven development with AngularJS
Bringing the light to the client with KnockoutJS
Identifying methods for measuring emotions

Recently uploaded (20)

PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
L1 - Introduction to python Backend.pptx
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
history of c programming in notes for students .pptx
PDF
top salesforce developer skills in 2025.pdf
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Operating system designcfffgfgggggggvggggggggg
PPT
Introduction Database Management System for Course Database
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Transform Your Business with a Software ERP System
PDF
medical staffing services at VALiNTRY
PPTX
Reimagine Home Health with the Power of Agentic AI​
Softaken Excel to vCard Converter Software.pdf
Which alternative to Crystal Reports is best for small or large businesses.pdf
Adobe Illustrator 28.6 Crack My Vision of Vector Design
L1 - Introduction to python Backend.pptx
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
history of c programming in notes for students .pptx
top salesforce developer skills in 2025.pdf
Design an Analysis of Algorithms II-SECS-1021-03
Designing Intelligence for the Shop Floor.pdf
Digital Strategies for Manufacturing Companies
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Operating system designcfffgfgggggggvggggggggg
Introduction Database Management System for Course Database
2025 Textile ERP Trends: SAP, Odoo & Oracle
Understanding Forklifts - TECH EHS Solution
Digital Systems & Binary Numbers (comprehensive )
Navsoft: AI-Powered Business Solutions & Custom Software Development
Transform Your Business with a Software ERP System
medical staffing services at VALiNTRY
Reimagine Home Health with the Power of Agentic AI​

The AngularJS way

  • 1. The AngularJS way Boyan Mihaylov, Ebita
  • 2. Agenda • Why AngularJS? • Hello, world • How does it work? • Foundation: the basic components • Real-case scenario development 2
  • 3. 3
  • 4. Why AngularJS? • Need to handle complex clients • jQuery is too low-level • MV* pattern on the client • No DOM operations • Data models are POJO • Huge community • 64 920+ questions on Stack Overflow • 11 701+ questions on Google Groups 4
  • 5. Hello, World! Text editor Browser directives data binding 5
  • 6. Bootstrapping <html ng-app> <body> {{expression}} </body> </html> Root scope Template Model 6
  • 7. Scopes • The glue between the view and the controller • A tree structure of objects • One root scope created per application • Every new scope is created from an existing one • Created automatically by AngularJS • Default creation is by prototypically inheritance 7
  • 8. Scopes: prototypical inheritance $rootScope .say = function() { … }; $scopeA $scopeB $scopeB1 .hey = function() { … }; 8
  • 9. How does it work? 1. Trigger key press event 2. Call $scope.$apply(“name = ‘Wo’”) 3. Call $scope.$digest() 1. Check for dirty items in the watch list 2. Repeat until there are no dirty items, max 10 times 4. Make the browser repaint the bound regions 9
  • 11. Modules (1) • Module-first approach • Separation of concerns • Plug and play • Dependencies 11
  • 12. Modules (2) Pointer to the module Module name An array with possible dependencies Retrieve a module by its name 12
  • 13. Modules (3) • ng-app may contain the name of the main application module Must refer to an existing module Defines a module 13
  • 14. Modules (4) • Two phases when initializing a module Module .config(…) .run(…) .config(…) .run(…) Configure the services before they are used. Services can be used here and cannot be reconfigured anymore 14
  • 15. Modules (5) • Modules can further define other components .controller(…) .directive(…) .filter(…) .factory(…) .service(…) .provider(…) .value(…) .constant(…) Module .controller(…) .directive(…) .filter(…) .factory(…) .service(…) .provider(…) .value(…) .constant(…) 15
  • 16. Controllers • Contain application-specific logic • Communicate with services • Should NOT manipulate the DOM • Assigned via ng-controller • Has own scope • Can have dependencies 16
  • 17. Dependency injection • Names define the instances to be injected • Implicit annotation 17 • Inline array annotation Can be renamed during minimization
  • 18. Directives • Encapsulate component logic • Have access to the HTML element • Can have own scope (or reuse parent’s one) • Can have dependencies 18
  • 19. Directive attachment Attribute CSS Class 19 HTML element Comment
  • 20. Built-in directives • ng-app – creates and initializes an AngularJS application • ng-model – associates a model with an input field • ng-click – executes a function when the user clicks on an element • ng-show – shows or hides an element based on an expression • ng-repeat – repeats a HTML element for a given input array of models 20
  • 21. Filters • Formats the value of an expression • Used in binding expressions – {{ expression | myFilter }} • Chaining of multiple filters – {{ expression | filter1 | filter2 }} • Can also be injected in controllers and directives 21
  • 22. Services • Contain your client-side business logic • Lazy initialized • Singletons • 5 types • Provider • Service • Factory • Value • Constant 22
  • 23. Services: provider (1) • The core service • The others are just syntactic sugar on top of it • Implements the factory method design pattern 23
  • 24. Services: provider (2) • Must provide a $get method that returns the service instance • Can contain dependencies • Can be configured during the configure phase • Injected as configurable providers during the configure phase • Injected as service instances elsewhere 24
  • 25. Services: factory and service • Can contain dependencies • Bigger control over the instance initialization • You get the value, returned from the provided function • Can contain dependencies • Produces a service by invoking a constructor with the new operator • You get a new instance of the provided function 25
  • 26. Services: value and constant • Cannot contain dependencies • Values are the simplest services • Their values can be changed • Constants can be injected during the configuration phase • Their values cannot be changed once assigned 26
  • 27. Let’s get our hands dirty 27 https://github.com/omeganet/The-Book-Rat/