SlideShare uma empresa Scribd logo
1 de 50
Baixar para ler offline
General
• Javascript Framework
• Angular = ng = &ng
• Angular is full-featured SPA framework
• Open-source web application framework
• Originally developed in 2009 by Miško Hevery and Adam Abrons
• Used as the business software behind an online JSON storage
service
• Safari, Chrome, Firefox, Opera, IE8, IE9 and mobile browsers
(Android, Chrome Mobile, iOS Safari)
• Versions
– Stable: 1.2.x
– Beta: 1.3.0
Versions
AngularJS Statistics
Resource: W3Tech
Investigated technologies of websites, not individual web pages from the
bank of 10 million web sites.
April 2013
ExtJs Usage Statistics
Resource: W3Tech
Investigated technologies of websites, not individual web pages from the
bank of 10 million web sites.
April 2013
AngularJS Ext JS jQuery
Feature detection[5] Yes Yes Yes
DOM wrapped[20] Yes Yes Yes
XMLHttpRequest
Yes Yes Yes
data retrieval
[WebSocket] Yes Yes
Server pushdata retrieval Yes Yes
Other data retrieval
Yes: XML, SOAP, AMF,
Ext.Direct
Yes: XML, HTML
Drag and drop Yes Yes
Simple visual effects Yes Yes Yes
Animation /
Yes Yes Yes
advanced visual effects
Event handling Yes Yes Yes
Back button support /
Yes With plugins[53]
history management
Input formwidgets & validation Yes Yes With plugins[59]
Grid Yes With plugins[64]
Hierarchical Tree Yes With plugins[74]
Rich text editor No Yes With plugins[85]
Autocompletiontools No Yes With plugins[90]
HTMLgeneration tools No Yes Yes
Comparison JavaScript Frameworks
AngularJS Ext JS jQuery
Widgets themeable / skinnable Yes[97] Yes[99]
GUI resizable panels and modal dialogs Yes With plugins
GUI page layout Yes With plugin[108]
Canvas support Yes With plugin[112]
Mobile/tablet support (touch events) Yes Yes With plugin[119]
Accessibility /
Yes Yes Yes
graceful degradation[124]
ARIA compliant Yes Yes[131]
Developer tools, Visual design Yes Yes[137][138]
Offline storage[144] Yes With plugin[149]
Cross-browser 2d Vector
Graphics[152]
Yes With plugin[155]
Charting & Dashboard[158] Yes With plugin[163][164]
RTL Support in UI Components Yes Depends on the plugin used
Comparison JavaScript Frameworks
AngularJS - Goals & Concept
• 100% Javascript
• Declarative Programming paradigm (like SQL)
• MVC
• jqLight – the light version of jquery
• Decouple DOM manipulation
• Size
AngularJS Backbone Ember
Size 36K 6.4K 69K
Key features
• Scope – object that refers to application model
• MVC
• Services
• Two-way data binding
• Directives
• Filters
• Validation
• Testable
• Dependency Injection
Basics
http://jsfiddle.net/sna19/WrZh2/
Let’s create MoveIt
http://plnkr.co/edit/YemibukYfCvpIy9Lblma?p=preview
Directives
Directives
• Markers on a DOM element
• Tells to the compiler to attach a specific
behavior to that DOM element
• Custom directives definition is possible
http://jsfiddle.net/roadprophet/DsvX6/
Most Useful Directives
• ng-app
• ng-bind
• ng-model
• ng-class
• ng-controller
• ng-switch, ng-if, ng-show, ng-hide
• ng-repeat
• ng-view
Model View Control
view
Controller
Model
Binding to model
MVC or MVW ?
Scope
Scope
• $scope - expose the domain model to a view
(template)
• By assigning properties to scope instances, we can
make new values available to a template for
rendering.
• Two types of scope
– Inherited
– Isolated (many scope models
view
Root scope
HelloCtrl
Scope
Input
Scope
Render
scope
Scope
Root scope
HelloCtrl
Scope
Input
Scope
Render
scope
<body>
<div>
<input>
<h1>
text
Scope
ScopeRoot Scope
MyController
scope
username : string
view
Controller
Model
Binding to model
$scope.getName = function() {
return $scope.name;
}
}
<h1>Hello, {{ getName() }}! </h1>
Scope
Controller
Controller
• The primary responsibility of a controller is to
initialize scope objects.
– Providing initial model values
– Augmenting $scope with UI-specific behavior
(functions)
• Controllers are regular JavaScript functions.
Application Scope
Controller - Example
Directives
http://plnkr.co/edit/Jp0F8UYnHQAwvdW3VsIl
Binding
Two-way data binding
Renders model value
Binding to model (variable)
Binding
• Basic Example
http://jsfiddle.net/sna19/T5yvB/
• MoveIt – simplest
http://plnkr.co/edit/hxLXgXd3Lvhm2FAVlYTY?p=preview
Filters
Filters
• Formats the value of an expression for display to the
user
• Can be used in view templates, controllers or
services
• Custom Filter
http://jsfiddle.net/CBgcP/413/
• MoveIt Custom Filter
http://plnkr.co/edit/0wl7Jh47wRKIHpwNaAnE?p=preview
• MoveIt Custom Filter with radio
http://plnkr.co/edit/pMZN90UxpHoQ3FE4tQhR?p=preview
In computer technologythe term (usually shortened to booting) usually refers to the process of
loading the basic software into the memory of a computer after power-on or general reset,
especially the operating system which will then take care of loading other software as needed.
In general parlance, bootstrapping usually refers to the starting of a self-sustaining process
that is supposed to proceed without external input
Bootstrap in AngularJS
• Create a new injector
• Compile (Walk through the DOM and locate all
directives)
• Link – attach all the directives to scope.
Bootstrap
Dependency …
Dependency Injection
• DI – Software Design Pattern that deals with how
components get hold of their dependencies.
• AngularJS is in charge of
– Creating component
– Resolving their dependencies
– Providing them to other components as requested.
• Injector knows to inject itself (first time it runs)
• Injector will only create an instance of a service once (the
next time it will use the cached one).
• You can inject service into controller, directive or filter
• Controllers cannot be injected into other things. Why?
DI in a Nutshell
• How component can get a hold on its dependencies?
– Typically using the new operator
– Looking up, by referring to a global variable
– Having the dependency passed to it where it is needed.
DI in a Nutshell
• How component can get a hold on its dependencies?
– Typically using the new operator
– Looking up, by referring to a global variable
– Having the dependency passed to it where it is needed.
• Removes the responsibility of locating the dependency from the
component
• However, SomeClass now is responsible of getting hold of the dependency
on the code that constructs Greeter.
• To manage the responsibility of dependency creation, each Angular
application has an injector. The injector is a service locator that is
responsible for construction and lookup of dependencies.
DI in a Nutshell
http://plnkr.co/edit/7IBuN94H9MMzere3QzDs?p=preview
DI in a Nutshell
• Why the parameters order is not important?
.toString()
DI - Example
http://plnkr.co/edit/YOHFHCzcGUGq800mZSOM?p=preview
Modules
Modules
• The declarative process is easier to understand
• Packaging code as reusable modules
• The order of loading modules is not important or
even parallel
• Unit testing
Other functions
• Lazy script loading
• Validation
• History
• jasmine unit test
References
Resources
• https://github.com/angular/angular.js/wiki/Understanding-Dependency-Injection
• http://twilson63.github.io/codecamp-angularjs-reveal/#/4
• https://docs.angularjs.org/guide
• “Mastering Web Application Development with AngularJS”, by Pavel Kozlovsky &
Peter Bacon Darwin, August,2013
Thank you

Mais conteúdo relacionado

Mais procurados

Angular2 Development for Java developers
Angular2 Development for Java developersAngular2 Development for Java developers
Angular2 Development for Java developersYakov Fain
 
Gettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJSGettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJSArmin Vieweg
 
Angular App Presentation
Angular App PresentationAngular App Presentation
Angular App PresentationElizabeth Long
 
Step by Step - AngularJS
Step by Step - AngularJSStep by Step - AngularJS
Step by Step - AngularJSInfragistics
 
Valentine with Angular js - Introduction
Valentine with Angular js - IntroductionValentine with Angular js - Introduction
Valentine with Angular js - IntroductionSenthil Kumar
 
AngularJS introduction
AngularJS introductionAngularJS introduction
AngularJS introductionTania Gonzales
 
The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014Matt Raible
 
Overview about AngularJS Framework
Overview about AngularJS Framework Overview about AngularJS Framework
Overview about AngularJS Framework Camilo Lopes
 
Sitecore MVC: Converting Web Forms sublayouts
Sitecore MVC: Converting Web Forms sublayoutsSitecore MVC: Converting Web Forms sublayouts
Sitecore MVC: Converting Web Forms sublayoutsnonlinear creations
 
Web sockets in Angular
Web sockets in AngularWeb sockets in Angular
Web sockets in AngularYakov Fain
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overviewJesse Warden
 
AngularJS intro
AngularJS introAngularJS intro
AngularJS introdizabl
 

Mais procurados (20)

Vue.js Use Cases
Vue.js Use CasesVue.js Use Cases
Vue.js Use Cases
 
Angular2 Development for Java developers
Angular2 Development for Java developersAngular2 Development for Java developers
Angular2 Development for Java developers
 
Gettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJSGettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJS
 
Angular App Presentation
Angular App PresentationAngular App Presentation
Angular App Presentation
 
Step by Step - AngularJS
Step by Step - AngularJSStep by Step - AngularJS
Step by Step - AngularJS
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
 
Valentine with Angular js - Introduction
Valentine with Angular js - IntroductionValentine with Angular js - Introduction
Valentine with Angular js - Introduction
 
Angular 4
Angular 4Angular 4
Angular 4
 
Introduction to Angular JS
Introduction to Angular JSIntroduction to Angular JS
Introduction to Angular JS
 
AngularJS introduction
AngularJS introductionAngularJS introduction
AngularJS introduction
 
The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014
 
Overview about AngularJS Framework
Overview about AngularJS Framework Overview about AngularJS Framework
Overview about AngularJS Framework
 
Sitecore MVC: Converting Web Forms sublayouts
Sitecore MVC: Converting Web Forms sublayoutsSitecore MVC: Converting Web Forms sublayouts
Sitecore MVC: Converting Web Forms sublayouts
 
Angular js
Angular jsAngular js
Angular js
 
Web sockets in Angular
Web sockets in AngularWeb sockets in Angular
Web sockets in Angular
 
Introduction to Unit Tests and TDD
Introduction to Unit Tests and TDDIntroduction to Unit Tests and TDD
Introduction to Unit Tests and TDD
 
Angular js
Angular jsAngular js
Angular js
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overview
 
AngularJS
AngularJSAngularJS
AngularJS
 
AngularJS intro
AngularJS introAngularJS intro
AngularJS intro
 

Semelhante a AngularJS Basics

Angular JS - Introduction
Angular JS - IntroductionAngular JS - Introduction
Angular JS - IntroductionSagar Acharya
 
Angular JS, A dive to concepts
Angular JS, A dive to conceptsAngular JS, A dive to concepts
Angular JS, A dive to conceptsAbhishek Sur
 
Angular patterns
Angular patternsAngular patterns
Angular patternsPremkumar M
 
Angular meetup 2 2019-08-29
Angular meetup 2   2019-08-29Angular meetup 2   2019-08-29
Angular meetup 2 2019-08-29Nitin Bhojwani
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to ProtractorFlorian Fesseler
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Ganesh Kondal
 
End to-End SPA Development Using ASP.NET and AngularJS
End to-End SPA Development Using ASP.NET and AngularJSEnd to-End SPA Development Using ASP.NET and AngularJS
End to-End SPA Development Using ASP.NET and AngularJSGil Fink
 
Creating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSCreating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSGunnar Hillert
 
What Is Angular 2 | Angular 2 Tutorial For Beginners | Angular Training | Edu...
What Is Angular 2 | Angular 2 Tutorial For Beginners | Angular Training | Edu...What Is Angular 2 | Angular 2 Tutorial For Beginners | Angular Training | Edu...
What Is Angular 2 | Angular 2 Tutorial For Beginners | Angular Training | Edu...Edureka!
 
Angular from Zero to Mastery - Training (Intermediate)
Angular from Zero to Mastery - Training (Intermediate)Angular from Zero to Mastery - Training (Intermediate)
Angular from Zero to Mastery - Training (Intermediate)Smail LOUNES
 
The future of web development write once, run everywhere with angular js an...
The future of web development   write once, run everywhere with angular js an...The future of web development   write once, run everywhere with angular js an...
The future of web development write once, run everywhere with angular js an...Mark Leusink
 
The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...Mark Roden
 
Integrating AngularJS into the Campus CMS
Integrating AngularJS into the Campus CMSIntegrating AngularJS into the Campus CMS
Integrating AngularJS into the Campus CMSTom Borger
 
ASP.NET MVC Best Practices malisa ncube
ASP.NET MVC Best Practices   malisa ncubeASP.NET MVC Best Practices   malisa ncube
ASP.NET MVC Best Practices malisa ncubeMalisa Ncube
 
AngularJs (1.x) Presentation
AngularJs (1.x) PresentationAngularJs (1.x) Presentation
AngularJs (1.x) PresentationRaghubir Singh
 
Using Automatic Refactoring to Improve Energy Efficiency of Android Apps
Using Automatic Refactoring to Improve Energy Efficiency of Android AppsUsing Automatic Refactoring to Improve Energy Efficiency of Android Apps
Using Automatic Refactoring to Improve Energy Efficiency of Android AppsLuis Cruz
 
Mobile and IBM Worklight Best Practices
Mobile and IBM Worklight Best PracticesMobile and IBM Worklight Best Practices
Mobile and IBM Worklight Best PracticesAndrew Ferrier
 
Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0Mayank Srivastava
 

Semelhante a AngularJS Basics (20)

Angular JS - Introduction
Angular JS - IntroductionAngular JS - Introduction
Angular JS - Introduction
 
Angular JS, A dive to concepts
Angular JS, A dive to conceptsAngular JS, A dive to concepts
Angular JS, A dive to concepts
 
Angular patterns
Angular patternsAngular patterns
Angular patterns
 
Angular meetup 2 2019-08-29
Angular meetup 2   2019-08-29Angular meetup 2   2019-08-29
Angular meetup 2 2019-08-29
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to Protractor
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5
 
End to-End SPA Development Using ASP.NET and AngularJS
End to-End SPA Development Using ASP.NET and AngularJSEnd to-End SPA Development Using ASP.NET and AngularJS
End to-End SPA Development Using ASP.NET and AngularJS
 
Ionic vancouver 201604
Ionic vancouver 201604Ionic vancouver 201604
Ionic vancouver 201604
 
Creating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSCreating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJS
 
What Is Angular 2 | Angular 2 Tutorial For Beginners | Angular Training | Edu...
What Is Angular 2 | Angular 2 Tutorial For Beginners | Angular Training | Edu...What Is Angular 2 | Angular 2 Tutorial For Beginners | Angular Training | Edu...
What Is Angular 2 | Angular 2 Tutorial For Beginners | Angular Training | Edu...
 
Angular from Zero to Mastery - Training (Intermediate)
Angular from Zero to Mastery - Training (Intermediate)Angular from Zero to Mastery - Training (Intermediate)
Angular from Zero to Mastery - Training (Intermediate)
 
The future of web development write once, run everywhere with angular js an...
The future of web development   write once, run everywhere with angular js an...The future of web development   write once, run everywhere with angular js an...
The future of web development write once, run everywhere with angular js an...
 
The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...
 
Integrating AngularJS into the Campus CMS
Integrating AngularJS into the Campus CMSIntegrating AngularJS into the Campus CMS
Integrating AngularJS into the Campus CMS
 
ASP.NET MVC Best Practices malisa ncube
ASP.NET MVC Best Practices   malisa ncubeASP.NET MVC Best Practices   malisa ncube
ASP.NET MVC Best Practices malisa ncube
 
JavaScript MVC Frameworks: Backbone, Ember and Angular JS
JavaScript MVC Frameworks: Backbone, Ember and Angular JSJavaScript MVC Frameworks: Backbone, Ember and Angular JS
JavaScript MVC Frameworks: Backbone, Ember and Angular JS
 
AngularJs (1.x) Presentation
AngularJs (1.x) PresentationAngularJs (1.x) Presentation
AngularJs (1.x) Presentation
 
Using Automatic Refactoring to Improve Energy Efficiency of Android Apps
Using Automatic Refactoring to Improve Energy Efficiency of Android AppsUsing Automatic Refactoring to Improve Energy Efficiency of Android Apps
Using Automatic Refactoring to Improve Energy Efficiency of Android Apps
 
Mobile and IBM Worklight Best Practices
Mobile and IBM Worklight Best PracticesMobile and IBM Worklight Best Practices
Mobile and IBM Worklight Best Practices
 
Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0
 

Último

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Último (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

AngularJS Basics

  • 1.
  • 2. General • Javascript Framework • Angular = ng = &ng • Angular is full-featured SPA framework • Open-source web application framework • Originally developed in 2009 by Miško Hevery and Adam Abrons • Used as the business software behind an online JSON storage service • Safari, Chrome, Firefox, Opera, IE8, IE9 and mobile browsers (Android, Chrome Mobile, iOS Safari) • Versions – Stable: 1.2.x – Beta: 1.3.0
  • 4. AngularJS Statistics Resource: W3Tech Investigated technologies of websites, not individual web pages from the bank of 10 million web sites. April 2013
  • 5. ExtJs Usage Statistics Resource: W3Tech Investigated technologies of websites, not individual web pages from the bank of 10 million web sites. April 2013
  • 6. AngularJS Ext JS jQuery Feature detection[5] Yes Yes Yes DOM wrapped[20] Yes Yes Yes XMLHttpRequest Yes Yes Yes data retrieval [WebSocket] Yes Yes Server pushdata retrieval Yes Yes Other data retrieval Yes: XML, SOAP, AMF, Ext.Direct Yes: XML, HTML Drag and drop Yes Yes Simple visual effects Yes Yes Yes Animation / Yes Yes Yes advanced visual effects Event handling Yes Yes Yes Back button support / Yes With plugins[53] history management Input formwidgets & validation Yes Yes With plugins[59] Grid Yes With plugins[64] Hierarchical Tree Yes With plugins[74] Rich text editor No Yes With plugins[85] Autocompletiontools No Yes With plugins[90] HTMLgeneration tools No Yes Yes Comparison JavaScript Frameworks
  • 7. AngularJS Ext JS jQuery Widgets themeable / skinnable Yes[97] Yes[99] GUI resizable panels and modal dialogs Yes With plugins GUI page layout Yes With plugin[108] Canvas support Yes With plugin[112] Mobile/tablet support (touch events) Yes Yes With plugin[119] Accessibility / Yes Yes Yes graceful degradation[124] ARIA compliant Yes Yes[131] Developer tools, Visual design Yes Yes[137][138] Offline storage[144] Yes With plugin[149] Cross-browser 2d Vector Graphics[152] Yes With plugin[155] Charting & Dashboard[158] Yes With plugin[163][164] RTL Support in UI Components Yes Depends on the plugin used Comparison JavaScript Frameworks
  • 8. AngularJS - Goals & Concept • 100% Javascript • Declarative Programming paradigm (like SQL) • MVC • jqLight – the light version of jquery • Decouple DOM manipulation • Size AngularJS Backbone Ember Size 36K 6.4K 69K
  • 9. Key features • Scope – object that refers to application model • MVC • Services • Two-way data binding • Directives • Filters • Validation • Testable • Dependency Injection
  • 14. Directives • Markers on a DOM element • Tells to the compiler to attach a specific behavior to that DOM element • Custom directives definition is possible http://jsfiddle.net/roadprophet/DsvX6/
  • 15. Most Useful Directives • ng-app • ng-bind • ng-model • ng-class • ng-controller • ng-switch, ng-if, ng-show, ng-hide • ng-repeat • ng-view
  • 18. Scope
  • 19. Scope • $scope - expose the domain model to a view (template) • By assigning properties to scope instances, we can make new values available to a template for rendering. • Two types of scope – Inherited – Isolated (many scope models
  • 23. view Controller Model Binding to model $scope.getName = function() { return $scope.name; } } <h1>Hello, {{ getName() }}! </h1> Scope
  • 25. Controller • The primary responsibility of a controller is to initialize scope objects. – Providing initial model values – Augmenting $scope with UI-specific behavior (functions) • Controllers are regular JavaScript functions.
  • 26. Application Scope Controller - Example Directives
  • 29. Two-way data binding Renders model value Binding to model (variable)
  • 31. • MoveIt – simplest http://plnkr.co/edit/hxLXgXd3Lvhm2FAVlYTY?p=preview
  • 33. Filters • Formats the value of an expression for display to the user • Can be used in view templates, controllers or services • Custom Filter http://jsfiddle.net/CBgcP/413/
  • 34. • MoveIt Custom Filter http://plnkr.co/edit/0wl7Jh47wRKIHpwNaAnE?p=preview • MoveIt Custom Filter with radio http://plnkr.co/edit/pMZN90UxpHoQ3FE4tQhR?p=preview
  • 35. In computer technologythe term (usually shortened to booting) usually refers to the process of loading the basic software into the memory of a computer after power-on or general reset, especially the operating system which will then take care of loading other software as needed. In general parlance, bootstrapping usually refers to the starting of a self-sustaining process that is supposed to proceed without external input
  • 36. Bootstrap in AngularJS • Create a new injector • Compile (Walk through the DOM and locate all directives) • Link – attach all the directives to scope.
  • 39. Dependency Injection • DI – Software Design Pattern that deals with how components get hold of their dependencies. • AngularJS is in charge of – Creating component – Resolving their dependencies – Providing them to other components as requested. • Injector knows to inject itself (first time it runs) • Injector will only create an instance of a service once (the next time it will use the cached one). • You can inject service into controller, directive or filter • Controllers cannot be injected into other things. Why?
  • 40. DI in a Nutshell • How component can get a hold on its dependencies? – Typically using the new operator – Looking up, by referring to a global variable – Having the dependency passed to it where it is needed.
  • 41. DI in a Nutshell • How component can get a hold on its dependencies? – Typically using the new operator – Looking up, by referring to a global variable – Having the dependency passed to it where it is needed. • Removes the responsibility of locating the dependency from the component
  • 42. • However, SomeClass now is responsible of getting hold of the dependency on the code that constructs Greeter. • To manage the responsibility of dependency creation, each Angular application has an injector. The injector is a service locator that is responsible for construction and lookup of dependencies. DI in a Nutshell http://plnkr.co/edit/7IBuN94H9MMzere3QzDs?p=preview
  • 43. DI in a Nutshell • Why the parameters order is not important? .toString()
  • 46. Modules • The declarative process is easier to understand • Packaging code as reusable modules • The order of loading modules is not important or even parallel • Unit testing
  • 47. Other functions • Lazy script loading • Validation • History • jasmine unit test
  • 49. Resources • https://github.com/angular/angular.js/wiki/Understanding-Dependency-Injection • http://twilson63.github.io/codecamp-angularjs-reveal/#/4 • https://docs.angularjs.org/guide • “Mastering Web Application Development with AngularJS”, by Pavel Kozlovsky & Peter Bacon Darwin, August,2013