SlideShare a Scribd company logo
ngularJS features
by Alexey Migutsky
all links are on the last slide
…and related gotchas
1. SCOPE
In scope we trust [1]
Scope is created
$rootScope
(always there)
ng-repeat
(for each iteration, inherits)
ng-include
(inherits)
ng-switch
(inherits)
ng-if
(when creating element)
ng-controller
(inherits)
ng-model
(inherits, thro implicit controller)
ng-view
(inherits, thro controller)
directive with scope:true
(inherits)
directive with transclude:true
(inherits, sibling)
directive with scope: {}
(does not inherit)
Scope is not created
directive with scope: false
(default value)
All directives, not mentioned on
the previous slide
Angular always tracks child-parent relationships,
even without inheritance
but $parent referencing is bad!
There can be only 1 scope per 1 element [2]
Directives are not mixins 
Isolated scope can isolate non-isolated scopes on the same element
Transcluded scope is sibling to directive’s scope
$parent
directive’s scope
transcluded $scope
2. DIGESTING
Run, $digest, run! [3]
5 angularjs features
Do not use $digest, use $apply in directives.
$digest is a single run, not the full cycle
$watch expression is called in $scope’s context!
In the expression this will refer to the $scope!
Do not use $watch with property getters without binding.
$digest event propagates inside isolated scopes!
The change in parent scope will trigger isolated watchers
Use events to handle ‘model changes’ sparingly [4]
Use $watch instead.
Digest cycle is fast…
…until you write bloated $watch exressions.
Watchtower [5] comes to the rescue!
3. DATABINDING
My name is Bind, Data Bind [6]
Expressions are JavaScript-like code
In case of emergency use $eval() and not eval()
Expressions have no flow control
Great decision for templates!
Expressions are evaluated against current scope.
Remember the $watch gotcha?
Expressions can have function call reference
You can specify parameters to be passed upon the call.
“someMethodCall( param1, param2 )”
Not very common, is it?
It should be called like this in JS:
someMethodCall( { param1 : ‘value’,
param2: ‘value2’
})
4. DEPENDENCY INJECTION
Injections are the best thing ever invented ... [7]
The only orthodoxal way to establish relationships
between components is DI.
5 angularjs features
Remember the ‘minification problem’[8]
Use array-based declarations.
Or just use ngmin [9].
AngularJS ‘runtime’ is an IoC container.
Read it like this: you should wrap 3rd party components, which are not
integrated with angular, into directives/services.
You can’t inject (use) them as is!
5. MODULARITY
True independence and freedom can only exist in doing what's right. [10]
Always use angular.module syntax
It is good for testing.
It is good for decoupling.
It helps manage dependencies.
Prefer module-per-feature approach [11]
It is good for testing.
It is good for refactoring and maintenance.
Using Angular with module loaders can be tricky
Angular ‘modules’ has a different nature.
Need some handcrafting to make modules and ‘modules’ play nicely.
Keep services/directives/modules as independent as possible.
This is #1 priority.
Use isolated scope for main directives.
Keep shared state in services.
Keep constructors in factories.
5 angularjs features
[1] In scope we trust
[2] 1 scope per 1 element
[3] Run, $digest, run!
[4] Why dirty checkings and not events?
[5] Project 'Watchtower'
[6] My name is Bind, Data Bind!
[7] Injections are the best things...
[8] Minification problem in Angular
[9] ngmin
[10] True independence and freedom
can only exist in doing what's right.
[11] module-per-feature architecture
Links
@mr_mig_by Alexey Migutsky

More Related Content

PDF
AngularJS: Overview & Key Features
Mohamad Al Asmar
 
PDF
AngularJS introduction
Tania Gonzales
 
PPTX
Introduction to Angularjs
Manish Shekhawat
 
PDF
Introduction of angular js
Tamer Solieman
 
PPTX
Angular js for beginners
Munir Hoque
 
PPTX
Angular js 1.3 presentation for fed nov 2014
Sarah Hudson
 
PDF
Angularjs architecture
Michael He
 
PDF
AngularJS - What is it & Why is it awesome ? (with demos)
Gary Arora
 
AngularJS: Overview & Key Features
Mohamad Al Asmar
 
AngularJS introduction
Tania Gonzales
 
Introduction to Angularjs
Manish Shekhawat
 
Introduction of angular js
Tamer Solieman
 
Angular js for beginners
Munir Hoque
 
Angular js 1.3 presentation for fed nov 2014
Sarah Hudson
 
Angularjs architecture
Michael He
 
AngularJS - What is it & Why is it awesome ? (with demos)
Gary Arora
 

What's hot (20)

PDF
AngularJS 101 - Everything you need to know to get started
Stéphane Bégaudeau
 
PDF
Angular js
Knoldus Inc.
 
PPTX
Angular JS - Introduction
Sagar Acharya
 
PPTX
The AngularJS way
Boyan Mihaylov
 
PPTX
Angular js
Dinusha Nandika
 
PPTX
Front end development with Angular JS
Bipin
 
PPTX
Step by Step - AngularJS
Infragistics
 
PPTX
AngularJs (1.x) Presentation
Raghubir Singh
 
PPTX
Angular js PPT
Imtiyaz Ahmad Khan
 
PPTX
AngularJs presentation
Phan Tuan
 
PDF
Introduction to AngularJS
Jussi Pohjolainen
 
PDF
AngularJS: an introduction
Luigi De Russis
 
PPTX
Angular js 1.3 basic tutorial
Al-Mutaz Bellah Salahat
 
PPTX
AngularJS intro
dizabl
 
PPTX
Why angular js Framework
Sakthi Bro
 
PPTX
Introduction to Angular js 2.0
Nagaraju Sangam
 
PDF
Advanced Tips & Tricks for using Angular JS
Simon Guest
 
PPTX
Introduction to AngularJS
David Parsons
 
PDF
AngularJS Basic Training
Cornel Stefanache
 
PPTX
Understanding angular js
Aayush Shrestha
 
AngularJS 101 - Everything you need to know to get started
Stéphane Bégaudeau
 
Angular js
Knoldus Inc.
 
Angular JS - Introduction
Sagar Acharya
 
The AngularJS way
Boyan Mihaylov
 
Angular js
Dinusha Nandika
 
Front end development with Angular JS
Bipin
 
Step by Step - AngularJS
Infragistics
 
AngularJs (1.x) Presentation
Raghubir Singh
 
Angular js PPT
Imtiyaz Ahmad Khan
 
AngularJs presentation
Phan Tuan
 
Introduction to AngularJS
Jussi Pohjolainen
 
AngularJS: an introduction
Luigi De Russis
 
Angular js 1.3 basic tutorial
Al-Mutaz Bellah Salahat
 
AngularJS intro
dizabl
 
Why angular js Framework
Sakthi Bro
 
Introduction to Angular js 2.0
Nagaraju Sangam
 
Advanced Tips & Tricks for using Angular JS
Simon Guest
 
Introduction to AngularJS
David Parsons
 
AngularJS Basic Training
Cornel Stefanache
 
Understanding angular js
Aayush Shrestha
 
Ad

Viewers also liked (6)

PPTX
Node.js in a heterogeneous system
Alexey (Mr_Mig) Migutsky
 
DOCX
Different way to share data between controllers in angular js
codeandyou forums
 
PPTX
DevOps in the clouds
Alexey (Mr_Mig) Migutsky
 
PPT
Let your website a ride of AngularJS
Mike Taylor
 
PDF
Software engineering 101 - The basics you should hear about at least once
Alexey (Mr_Mig) Migutsky
 
PDF
29 Essential AngularJS Interview Questions
Arc & Codementor
 
Node.js in a heterogeneous system
Alexey (Mr_Mig) Migutsky
 
Different way to share data between controllers in angular js
codeandyou forums
 
DevOps in the clouds
Alexey (Mr_Mig) Migutsky
 
Let your website a ride of AngularJS
Mike Taylor
 
Software engineering 101 - The basics you should hear about at least once
Alexey (Mr_Mig) Migutsky
 
29 Essential AngularJS Interview Questions
Arc & Codementor
 
Ad

Similar to 5 angularjs features (20)

PDF
AngularJS Workshop
Gianluca Cacace
 
PPTX
Angular workshop - Full Development Guide
Nitin Giri
 
ODP
Angular js-crash-course
Keith Bloomfield
 
PPT
Coffee@DBG - Exploring Angular JS
Deepu S Nath
 
ODP
AngularJs Crash Course
Keith Bloomfield
 
DOCX
angularjs_tutorial.docx
telegramvip
 
PPTX
Intro to AngularJs
SolTech, Inc.
 
PDF
AngularJS - TechTalk 3/2/2014
Spyros Ioakeimidis
 
PPTX
AngularJS
Yogesh L
 
PDF
AngularJS
Hiten Pratap Singh
 
PPTX
Practical AngularJS
Wei Ru
 
PPTX
Learning AngularJS - Complete coverage of AngularJS features and concepts
Suresh Patidar
 
PPTX
Single Page Applications Workshop Part II: Single Page Applications using Ang...
Jalal Mostafa
 
PPSX
Angular js
Arun Somu Panneerselvam
 
PPT
Angular js
yogi_solanki
 
PPTX
Angular js 1.0-fundamentals
Venkatesh Narayanan
 
PPTX
AngularJS.part1
Andrey Kolodnitsky
 
PDF
5 benefits of angular js
OnGraph Technologies Pvt. Ltd.
 
AngularJS Workshop
Gianluca Cacace
 
Angular workshop - Full Development Guide
Nitin Giri
 
Angular js-crash-course
Keith Bloomfield
 
Coffee@DBG - Exploring Angular JS
Deepu S Nath
 
AngularJs Crash Course
Keith Bloomfield
 
angularjs_tutorial.docx
telegramvip
 
Intro to AngularJs
SolTech, Inc.
 
AngularJS - TechTalk 3/2/2014
Spyros Ioakeimidis
 
AngularJS
Yogesh L
 
Practical AngularJS
Wei Ru
 
Learning AngularJS - Complete coverage of AngularJS features and concepts
Suresh Patidar
 
Single Page Applications Workshop Part II: Single Page Applications using Ang...
Jalal Mostafa
 
Angular js
yogi_solanki
 
Angular js 1.0-fundamentals
Venkatesh Narayanan
 
AngularJS.part1
Andrey Kolodnitsky
 
5 benefits of angular js
OnGraph Technologies Pvt. Ltd.
 

Recently uploaded (20)

PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
DevOps & Developer Experience Summer BBQ
AUGNYC
 
PPTX
Stamford - Community User Group Leaders_ Agentblazer Status, AI Sustainabilit...
Amol Dixit
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
PPT
L2 Rules of Netiquette in Empowerment technology
Archibal2
 
PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
PDF
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
PDF
This slide provides an overview Technology
mineshkharadi333
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
Software Development Methodologies in 2025
KodekX
 
PPTX
How to Build a Scalable Micro-Investing Platform in 2025 - A Founder’s Guide ...
Third Rock Techkno
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PPT
Coupa-Kickoff-Meeting-Template presentai
annapureddyn
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
DevOps & Developer Experience Summer BBQ
AUGNYC
 
Stamford - Community User Group Leaders_ Agentblazer Status, AI Sustainabilit...
Amol Dixit
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
L2 Rules of Netiquette in Empowerment technology
Archibal2
 
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
This slide provides an overview Technology
mineshkharadi333
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
Software Development Methodologies in 2025
KodekX
 
How to Build a Scalable Micro-Investing Platform in 2025 - A Founder’s Guide ...
Third Rock Techkno
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
Coupa-Kickoff-Meeting-Template presentai
annapureddyn
 

5 angularjs features

  • 1. ngularJS features by Alexey Migutsky all links are on the last slide …and related gotchas
  • 2. 1. SCOPE In scope we trust [1]
  • 3. Scope is created $rootScope (always there) ng-repeat (for each iteration, inherits) ng-include (inherits) ng-switch (inherits) ng-if (when creating element) ng-controller (inherits) ng-model (inherits, thro implicit controller) ng-view (inherits, thro controller) directive with scope:true (inherits) directive with transclude:true (inherits, sibling) directive with scope: {} (does not inherit)
  • 4. Scope is not created directive with scope: false (default value) All directives, not mentioned on the previous slide
  • 5. Angular always tracks child-parent relationships, even without inheritance but $parent referencing is bad!
  • 6. There can be only 1 scope per 1 element [2] Directives are not mixins  Isolated scope can isolate non-isolated scopes on the same element
  • 7. Transcluded scope is sibling to directive’s scope $parent directive’s scope transcluded $scope
  • 10. Do not use $digest, use $apply in directives. $digest is a single run, not the full cycle
  • 11. $watch expression is called in $scope’s context! In the expression this will refer to the $scope! Do not use $watch with property getters without binding.
  • 12. $digest event propagates inside isolated scopes! The change in parent scope will trigger isolated watchers
  • 13. Use events to handle ‘model changes’ sparingly [4] Use $watch instead. Digest cycle is fast… …until you write bloated $watch exressions. Watchtower [5] comes to the rescue!
  • 14. 3. DATABINDING My name is Bind, Data Bind [6]
  • 15. Expressions are JavaScript-like code In case of emergency use $eval() and not eval()
  • 16. Expressions have no flow control Great decision for templates!
  • 17. Expressions are evaluated against current scope. Remember the $watch gotcha?
  • 18. Expressions can have function call reference You can specify parameters to be passed upon the call. “someMethodCall( param1, param2 )” Not very common, is it? It should be called like this in JS: someMethodCall( { param1 : ‘value’, param2: ‘value2’ })
  • 19. 4. DEPENDENCY INJECTION Injections are the best thing ever invented ... [7]
  • 20. The only orthodoxal way to establish relationships between components is DI.
  • 22. Remember the ‘minification problem’[8] Use array-based declarations. Or just use ngmin [9].
  • 23. AngularJS ‘runtime’ is an IoC container. Read it like this: you should wrap 3rd party components, which are not integrated with angular, into directives/services. You can’t inject (use) them as is!
  • 24. 5. MODULARITY True independence and freedom can only exist in doing what's right. [10]
  • 25. Always use angular.module syntax It is good for testing. It is good for decoupling. It helps manage dependencies.
  • 26. Prefer module-per-feature approach [11] It is good for testing. It is good for refactoring and maintenance.
  • 27. Using Angular with module loaders can be tricky Angular ‘modules’ has a different nature. Need some handcrafting to make modules and ‘modules’ play nicely.
  • 28. Keep services/directives/modules as independent as possible. This is #1 priority. Use isolated scope for main directives. Keep shared state in services. Keep constructors in factories.
  • 30. [1] In scope we trust [2] 1 scope per 1 element [3] Run, $digest, run! [4] Why dirty checkings and not events? [5] Project 'Watchtower' [6] My name is Bind, Data Bind! [7] Injections are the best things... [8] Minification problem in Angular [9] ngmin [10] True independence and freedom can only exist in doing what's right. [11] module-per-feature architecture Links @mr_mig_by Alexey Migutsky