SlideShare uma empresa Scribd logo
1 de 17
HTML enhanced for web apps!HTML enhanced for web apps!
Back in time ...
Websites instead of webapps
Client seen as an interface
All the workload handled by
the server
No client-side logic
Javascript coder seen as web
designer
… when dinosaurs rule the Earth
Getting into the present day...
AJAX – HTML5 – CSS3
Web 2.0
Client splitted from server
Lots of new Javascript libraries
Webapp
Javascript: the answer!
Javascript frameworks
MVC Architecture
Big webapp
No more comparison with
web designers!
A current problem
Too much time
Too much code
Too much stress
Building client-side
webapp is still hard
DOM Manipulation
Data validation
Angular for the life!
Data-binding
Basic templating directives
Form validation
Routing
Reusable components
Dependency injection
Unit-testing
Bootstrap
Load HTML DOM
Load the module associated with
the directive
Create the application injector
Compile the DOM treating the ng-
app directive as the root of the
compilation
Conceptual Overview
1. The browser loads the HTML and parses it
into a DOM
2. The browser loads angular.js script
3. Angular waits for DOMContentLoaded event
4. Angular looks for ng-app directive, which
designates the application boundary
5. The Module specified in ng-app (if any) is
used to configure the $injector
6. The $injector is used to create the $compile
service as well as $rootScope
7. The $compile service is used to compile the
DOM and link it with $rootScope
HTML Compiler
Compile: traverse the DOM and collect all of the directives.
The result is a linking function.
Link: combine the directives with a scope and produce a
live view. Any changes in the scope model are reflected in
the view, and any user interactions with the view are
reflected in the scope model. This makes the scope model
the single source of truth.
Compiler is an angular service which traverses the DOM looking for attributes
Data-binding
Also known as MVVM
Runtime
1. The browser's event-loop waits
for an event to arrive. An event is
a user interaction, timer event, or
network event (response from a
server)
2. The event's callback gets
executed. This enters the
JavaScript context. The callback
can modify the DOM structure
3. Once the callback executes,
the browser leaves the JavaScript
context and re-renders the view
based on DOM changes.
Runtime in detail
1. Enter Angular execution context by calling scope.
$apply(stimulusFn)
2. Angular executes the stimulusFn(), which typically modifies
application state
3. Angular enters the $digest loop. The loop is made up of two smaller
loops which process $evalAsync queue and the $watch list. The
$digest loop keeps iterating until the model stabilizes.
4. The $evalAsync queue is used to schedule work which needs to
occur outside of current stack frame, but before the browser's view
render
5. The $watch list is a set of expressions which may have changed
since last iteration. If a change is detected then the $watch function is
called which typically updates the DOM with the new value
7. Once the Angular $digest loop finishes the execution leaves the
Angular and JavaScript context. This is followed by the browser re-
rendering the DOM to reflect any changes
Scope & View
The browser parses the HTML into
the DOM, and the DOM becomes
the input to the template engine
known as the compiler. The
compiler looks for directives which
in turn set up watches on the model.
The result is a continuously
updating view which does not need
template model re-merging. Your
model becomes the single source-
of-truth for your view.
The scope is responsible for detecting changes to the model section
and provides the execution context for expressions.
Directives & Filters
A directive is a behavior or DOM transformation which is triggered by
the presence of a custom attribute, element name, or a class name. A
directive allows you to extend the HTML vocabulary in a declarative
fashion.
<input type=”text” ng-model=”user.name” placeholder=”Foo”/>
Filters perform data transformation. Typically they are used in
conjunction with the locale to format the data in locale specific output.
They follow the spirit of UNIX filters and use similar syntax | (pipe).
<div>Negative number: {{val | number:2}}</div>
<div>Your name (in lowercase): {{user.name | lowercase}}</div>
Modules & Injectors
The injector is a service locator. There
is a single injector per Angular
application. The injector provides a
way to look up an object instance by its
name. The injector keeps an internal
cache of all objects so that repeated
calls to get the same object name
result in the same instance. If the
object does not exist, then the injector
asks the instance factory to create a
new instance.
A module is a way to configure the injector's instance factory, known
as a provider.
What's next?
Forms
i18n & l10n
Modules
Dependencies
MVC
E2E Testing
Angular Services
etc etc etc
The End

Mais conteúdo relacionado

Mais procurados

Practical AngularJS
Practical AngularJSPractical AngularJS
Practical AngularJS
Wei Ru
 

Mais procurados (20)

Angularjs Basics
Angularjs BasicsAngularjs Basics
Angularjs Basics
 
Angular js
Angular jsAngular js
Angular js
 
The AngularJS way
The AngularJS wayThe AngularJS way
The AngularJS way
 
Building scalable applications with angular js
Building scalable applications with angular jsBuilding scalable applications with angular js
Building scalable applications with angular js
 
AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
 
AngularJS best-practices
AngularJS best-practicesAngularJS best-practices
AngularJS best-practices
 
AngularJS introduction
AngularJS introductionAngularJS introduction
AngularJS introduction
 
Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0 Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0
 
Angular JS - Introduction
Angular JS - IntroductionAngular JS - Introduction
Angular JS - Introduction
 
Practical AngularJS
Practical AngularJSPractical AngularJS
Practical AngularJS
 
Angular js architecture (v1.4.8)
Angular js architecture (v1.4.8)Angular js architecture (v1.4.8)
Angular js architecture (v1.4.8)
 
Angular2 Development for Java developers
Angular2 Development for Java developersAngular2 Development for Java developers
Angular2 Development for Java developers
 
Workshop 14: AngularJS Parte III
Workshop 14: AngularJS Parte IIIWorkshop 14: AngularJS Parte III
Workshop 14: AngularJS Parte III
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
 
Workshop 13: AngularJS Parte II
Workshop 13: AngularJS Parte IIWorkshop 13: AngularJS Parte II
Workshop 13: AngularJS Parte II
 
Dependency Injection @ AngularJS
Dependency Injection @ AngularJSDependency Injection @ AngularJS
Dependency Injection @ AngularJS
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
AngularJS Project Setup step-by- step guide - RapidValue Solutions
AngularJS Project Setup step-by- step guide - RapidValue SolutionsAngularJS Project Setup step-by- step guide - RapidValue Solutions
AngularJS Project Setup step-by- step guide - RapidValue Solutions
 
Front end development with Angular JS
Front end development with Angular JSFront end development with Angular JS
Front end development with Angular JS
 

Semelhante a Angularjs

Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
Rob Davarnia
 

Semelhante a Angularjs (20)

Client Side MVC & Angular
Client Side MVC & AngularClient Side MVC & Angular
Client Side MVC & Angular
 
AngularJS: Overview & Key Features
AngularJS: Overview & Key FeaturesAngularJS: Overview & Key Features
AngularJS: Overview & Key Features
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
 
AngularJS - Javascript framework for superheroes
AngularJS - Javascript framework for superheroesAngularJS - Javascript framework for superheroes
AngularJS - Javascript framework for superheroes
 
Angular JS - Javascript framework for superheroes
Angular JS - Javascript framework for superheroesAngular JS - Javascript framework for superheroes
Angular JS - Javascript framework for superheroes
 
Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to Angularjs
 
Introduction to Angularjs : kishan kumar
Introduction to Angularjs : kishan kumarIntroduction to Angularjs : kishan kumar
Introduction to Angularjs : kishan kumar
 
Jinal desai .net
Jinal desai .netJinal desai .net
Jinal desai .net
 
Android chapter16-web-services
Android chapter16-web-servicesAndroid chapter16-web-services
Android chapter16-web-services
 
Mvc interview questions – deep dive jinal desai
Mvc interview questions – deep dive   jinal desaiMvc interview questions – deep dive   jinal desai
Mvc interview questions – deep dive jinal desai
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular js
 
Angular.js interview questions
Angular.js interview questionsAngular.js interview questions
Angular.js interview questions
 
Unit 07: Design Patterns and Frameworks (1/3)
Unit 07: Design Patterns and Frameworks (1/3)Unit 07: Design Patterns and Frameworks (1/3)
Unit 07: Design Patterns and Frameworks (1/3)
 
MVC
MVCMVC
MVC
 
.NET,ASP .NET, Angular Js,LinQ
.NET,ASP .NET, Angular Js,LinQ.NET,ASP .NET, Angular Js,LinQ
.NET,ASP .NET, Angular Js,LinQ
 
MVC
MVCMVC
MVC
 
Single Page Application
Single Page ApplicationSingle Page Application
Single Page Application
 
DDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFrameworkDDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFramework
 
Modern webtechnologies
Modern webtechnologiesModern webtechnologies
Modern webtechnologies
 
Advanced web application architecture Way2Web
Advanced web application architecture Way2WebAdvanced web application architecture Way2Web
Advanced web application architecture Way2Web
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Angularjs

  • 1. HTML enhanced for web apps!HTML enhanced for web apps!
  • 2. Back in time ... Websites instead of webapps Client seen as an interface All the workload handled by the server No client-side logic Javascript coder seen as web designer … when dinosaurs rule the Earth
  • 3. Getting into the present day... AJAX – HTML5 – CSS3 Web 2.0 Client splitted from server Lots of new Javascript libraries Webapp
  • 4. Javascript: the answer! Javascript frameworks MVC Architecture Big webapp No more comparison with web designers!
  • 5. A current problem Too much time Too much code Too much stress Building client-side webapp is still hard DOM Manipulation Data validation
  • 6. Angular for the life! Data-binding Basic templating directives Form validation Routing Reusable components Dependency injection Unit-testing
  • 7. Bootstrap Load HTML DOM Load the module associated with the directive Create the application injector Compile the DOM treating the ng- app directive as the root of the compilation
  • 8. Conceptual Overview 1. The browser loads the HTML and parses it into a DOM 2. The browser loads angular.js script 3. Angular waits for DOMContentLoaded event 4. Angular looks for ng-app directive, which designates the application boundary 5. The Module specified in ng-app (if any) is used to configure the $injector 6. The $injector is used to create the $compile service as well as $rootScope 7. The $compile service is used to compile the DOM and link it with $rootScope
  • 9. HTML Compiler Compile: traverse the DOM and collect all of the directives. The result is a linking function. Link: combine the directives with a scope and produce a live view. Any changes in the scope model are reflected in the view, and any user interactions with the view are reflected in the scope model. This makes the scope model the single source of truth. Compiler is an angular service which traverses the DOM looking for attributes
  • 11. Runtime 1. The browser's event-loop waits for an event to arrive. An event is a user interaction, timer event, or network event (response from a server) 2. The event's callback gets executed. This enters the JavaScript context. The callback can modify the DOM structure 3. Once the callback executes, the browser leaves the JavaScript context and re-renders the view based on DOM changes.
  • 12. Runtime in detail 1. Enter Angular execution context by calling scope. $apply(stimulusFn) 2. Angular executes the stimulusFn(), which typically modifies application state 3. Angular enters the $digest loop. The loop is made up of two smaller loops which process $evalAsync queue and the $watch list. The $digest loop keeps iterating until the model stabilizes. 4. The $evalAsync queue is used to schedule work which needs to occur outside of current stack frame, but before the browser's view render 5. The $watch list is a set of expressions which may have changed since last iteration. If a change is detected then the $watch function is called which typically updates the DOM with the new value 7. Once the Angular $digest loop finishes the execution leaves the Angular and JavaScript context. This is followed by the browser re- rendering the DOM to reflect any changes
  • 13. Scope & View The browser parses the HTML into the DOM, and the DOM becomes the input to the template engine known as the compiler. The compiler looks for directives which in turn set up watches on the model. The result is a continuously updating view which does not need template model re-merging. Your model becomes the single source- of-truth for your view. The scope is responsible for detecting changes to the model section and provides the execution context for expressions.
  • 14. Directives & Filters A directive is a behavior or DOM transformation which is triggered by the presence of a custom attribute, element name, or a class name. A directive allows you to extend the HTML vocabulary in a declarative fashion. <input type=”text” ng-model=”user.name” placeholder=”Foo”/> Filters perform data transformation. Typically they are used in conjunction with the locale to format the data in locale specific output. They follow the spirit of UNIX filters and use similar syntax | (pipe). <div>Negative number: {{val | number:2}}</div> <div>Your name (in lowercase): {{user.name | lowercase}}</div>
  • 15. Modules & Injectors The injector is a service locator. There is a single injector per Angular application. The injector provides a way to look up an object instance by its name. The injector keeps an internal cache of all objects so that repeated calls to get the same object name result in the same instance. If the object does not exist, then the injector asks the instance factory to create a new instance. A module is a way to configure the injector's instance factory, known as a provider.
  • 16. What's next? Forms i18n & l10n Modules Dependencies MVC E2E Testing Angular Services etc etc etc