SlideShare a Scribd company logo
Angular Directives | Angular 2 Custom Directives | Angular Tutorial | Angular Training | Edureka
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Agenda
❖ Why we need Angular Directive?
❖ What is Angular Directive?
❖ Types of Angular Directive
❖ Built-in Angular Directives
❖ Working with Custom Angular Directives
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Why We Need Angular Directive?
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Component 1
Component 2
{ }
{ }
Component 4
Component …
Component 3
Component …
{ }
{ }
{ }
{ }
Why we need Directive?
Component 1
Component 2
{ }
{ }
Component 4
Component …
Component 3
Component …
{ }
{ }
{ }
{ }
Changing code for Component 1
Similarly changing code for each components individually…
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Component 1
Component 2
{ }
{ }
Component 4
Component …
Component 3
Component …
{ }
{ }
{ }
{ }
Component 1
Component 2
{ }
{ }
Component 4
Component …
Component 3
Component …
{ }
{ }
{ }
{ }
DirectiveCreate a with required
behavior
Just Import the Directive to all
Components
Directives can be imported anywhere providing similar functionality
Directive
Directive
Directive
Directive
Directive
Directive
Why we need Directive?
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Why we need Directive?
Code modular & manageable
Reusable code
Separating that code out from the view, helps developer to
focus on UI and application logic separately
Available as a stand-alone reusable unit
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
What is Angular Directive?
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Directives Introduction
Directives extend HTML
with new attributes
DOM is transformed according
to directives instructions
Appear within an element tag
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Directives Introduction
Angular provides a set of built-in
directives which offers functionality
Create custom directives
A directive is a class with a
@Directive decorator
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Types of Angular Directive
www.edureka.co/angular-jsEDUREKA ANGULAR-JS CERTIFICATION TRAINING
Types of Angular Directives
Components
1
Structural Directives
2
Attributes Directive
3
Directives with a template
Adds & removes DOM elements to change DOM layout
Changes the appearance or behavior of an element
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Component Directive
@Component decorator is a @Directive decorator
extended with template-oriented features
A component is technically a directive-with-a-template
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Structural Directives
Structural directives alter layout by adding, removing, and replacing elements in DOM.
*ngFor tells Angular to stamp out one
<li> per course in the courses list.
*ngIf includes the CourseDetail
component only if a selected course exists
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Attribute Directives
Attribute Directive alter the appearance or
behavior of an existing element
Displays value property and responds to
changing events
ngModel modifies the behavior of an
existing element
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Built-In Angular Directives
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Built-in Angular Directives
NgStyle
NgIf
NgSwitch
NgFor
NgClass NgClass is used for class binding – adding or
removing several classes
Adding an NgClass property binding sets the
element's classes accordingly
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Built-in Angular Directives
NgStyle
NgIf
NgSwitch
NgFor
NgClass
NgStyle helps in style binding
NgStyle directive is a better choice while
setting many inline styles
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Built-in Angular Directives
NgStyle
NgIf
NgSwitch
NgFor
NgClass
Adds an element subtree to the DOM by
binding an NgIf directive
Binding to a false expression removes the
element subtree from the DOM
VISIBILITY AND NGIF ARE NOT THE SAME
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Built-in Angular Directives
NgStyle
NgIf
NgSwitch
NgFor
NgClass
NgSwitch displays one element from a set of
element trees based on conditions
Returns a switch value
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Built-in Angular Directives
NgStyle
NgIf
NgSwitch
NgFor
NgClass
At any particular moment, at most one of these
spans is in the DOM
3 collaborating directives are at work here:
ngSwitch
1
ngSwitchCase
2
ngSwitchDefault
3
bound to an expression that returns the switch value
bound to an expression returning a match value
a marker attribute on the default element
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Built-in Angular Directives
NgStyle
NgIf
NgSwitch
NgFor
NgClass
NgFor is a repeater directive - presents a list of
items
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
* and template
* modify HTML layout with the help of
templates
NgFor, NgIf, and NgSwitch adds and removes
elements
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Custom Attribute Directive
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Custom Attribute Directive
Directive
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Custom Attribute Directive
provides the functionality of
the @Directive decorator.
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Custom Attribute Directive
It can access the DOM
element
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Custom Attribute Directive
Subscribe to events of the
DOM element
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Custom Attribute Directive
Allows data to flow from the binding
expression into the directive
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Custom Attribute Directive
Contains the directive
metadata in a
configuration object
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Custom Attribute Directive
Identifies the HTML in the template
that is associated with the directive
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Custom Attribute Directive
Directive Class that performs
operation
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Custom Attribute Directive
Grants direct access to the DOM
element through
its nativeElement property
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Custom Attribute Directive
Listens to the event and perform
accordingly
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Custom Structural Directive
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Hands-On
EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js
Thank You …
Questions/Queries/Feedback

More Related Content

What's hot (20)

PPT
Angular 8
Sunil OS
 
PDF
Angular Observables & RxJS Introduction
Rahat Khanna a.k.a mAppMechanic
 
PDF
Angular components
Sultan Ahmed
 
PDF
Angular Pipes Workshop
Nir Kaufman
 
PDF
Angular - Chapter 7 - HTTP Services
WebStackAcademy
 
PPTX
Angular 2.0 forms
Eyal Vardi
 
PPTX
ASP.NET Core MVC + Web API with Overview
Shahed Chowdhuri
 
PDF
Angular - Chapter 3 - Components
WebStackAcademy
 
PPTX
Angularjs PPT
Amit Baghel
 
PPTX
Angular Directives
Malla Reddy University
 
PDF
Présentation Angular 2
Cynapsys It Hotspot
 
PPTX
Introduction to angular with a simple but complete project
Jadson Santos
 
PPTX
Angular 5 presentation for beginners
Imran Qasim
 
PPTX
Nodejs functions & modules
monikadeshmane
 
PPTX
Introduction Node.js
Erik van Appeldoorn
 
PDF
Angular Advanced Routing
Laurent Duveau
 
PPTX
Angular 14.pptx
MohaNedGhawar
 
ODP
Angular 4 The new Http Client Module
arjun singh
 
PPTX
React js
Oswald Campesato
 
PDF
Angular - Chapter 4 - Data and Event Handling
WebStackAcademy
 
Angular 8
Sunil OS
 
Angular Observables & RxJS Introduction
Rahat Khanna a.k.a mAppMechanic
 
Angular components
Sultan Ahmed
 
Angular Pipes Workshop
Nir Kaufman
 
Angular - Chapter 7 - HTTP Services
WebStackAcademy
 
Angular 2.0 forms
Eyal Vardi
 
ASP.NET Core MVC + Web API with Overview
Shahed Chowdhuri
 
Angular - Chapter 3 - Components
WebStackAcademy
 
Angularjs PPT
Amit Baghel
 
Angular Directives
Malla Reddy University
 
Présentation Angular 2
Cynapsys It Hotspot
 
Introduction to angular with a simple but complete project
Jadson Santos
 
Angular 5 presentation for beginners
Imran Qasim
 
Nodejs functions & modules
monikadeshmane
 
Introduction Node.js
Erik van Appeldoorn
 
Angular Advanced Routing
Laurent Duveau
 
Angular 14.pptx
MohaNedGhawar
 
Angular 4 The new Http Client Module
arjun singh
 
Angular - Chapter 4 - Data and Event Handling
WebStackAcademy
 

Similar to Angular Directives | Angular 2 Custom Directives | Angular Tutorial | Angular Training | Edureka (20)

PDF
Angular 4 Directives | Angular 4 Tutorial For Beginners | Angular 4 Directive...
Edureka!
 
PDF
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | Edureka
Edureka!
 
PDF
Angular - Chapter 5 - Directives
WebStackAcademy
 
PPTX
Learning AngularJS - Complete coverage of AngularJS features and concepts
Suresh Patidar
 
PPTX
Agular 2 - 6 Directives
Rajneeshksharma
 
PPTX
ME vs WEB - AngularJS Fundamentals
Aviran Cohen
 
PPTX
Live Demo : Trending Angular JS Featues
Edureka!
 
PPTX
Fly High With Angular - How to build an app using Angular
Vacation Labs
 
PPTX
AngularJs Workshop SDP December 28th 2014
Ran Wahle
 
PPTX
Angular Presentation
Adam Moore
 
PPTX
Introduction to AngularJs
murtazahaveliwala
 
PPTX
mean stack
michaelaaron25322
 
PPTX
ANGULARJS introduction components services and directives
SanthoshB77
 
PDF
Angular directives and pipes
Knoldus Inc.
 
PPTX
angularJs Workshop
Ran Wahle
 
PPTX
Angular Course.pptx
Imdad Ullah
 
PPTX
AIT SEMINAR.pptx
bhavyag24
 
PPTX
Front end development with Angular JS
Bipin
 
PDF
AngularJS Basics
Ravi Mone
 
Angular 4 Directives | Angular 4 Tutorial For Beginners | Angular 4 Directive...
Edureka!
 
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | Edureka
Edureka!
 
Angular - Chapter 5 - Directives
WebStackAcademy
 
Learning AngularJS - Complete coverage of AngularJS features and concepts
Suresh Patidar
 
Agular 2 - 6 Directives
Rajneeshksharma
 
ME vs WEB - AngularJS Fundamentals
Aviran Cohen
 
Live Demo : Trending Angular JS Featues
Edureka!
 
Fly High With Angular - How to build an app using Angular
Vacation Labs
 
AngularJs Workshop SDP December 28th 2014
Ran Wahle
 
Angular Presentation
Adam Moore
 
Introduction to AngularJs
murtazahaveliwala
 
mean stack
michaelaaron25322
 
ANGULARJS introduction components services and directives
SanthoshB77
 
Angular directives and pipes
Knoldus Inc.
 
angularJs Workshop
Ran Wahle
 
Angular Course.pptx
Imdad Ullah
 
AIT SEMINAR.pptx
bhavyag24
 
Front end development with Angular JS
Bipin
 
AngularJS Basics
Ravi Mone
 
Ad

More from Edureka! (20)

PDF
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
PDF
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
PDF
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
PDF
Tableau Tutorial for Data Science | Edureka
Edureka!
 
PDF
Python Programming Tutorial | Edureka
Edureka!
 
PDF
Top 5 PMP Certifications | Edureka
Edureka!
 
PDF
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
PDF
Linux Mint Tutorial | Edureka
Edureka!
 
PDF
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
PDF
Importance of Digital Marketing | Edureka
Edureka!
 
PDF
RPA in 2020 | Edureka
Edureka!
 
PDF
Email Notifications in Jenkins | Edureka
Edureka!
 
PDF
EA Algorithm in Machine Learning | Edureka
Edureka!
 
PDF
Cognitive AI Tutorial | Edureka
Edureka!
 
PDF
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
PDF
Blue Prism Top Interview Questions | Edureka
Edureka!
 
PDF
Big Data on AWS Tutorial | Edureka
Edureka!
 
PDF
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
PDF
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
PDF
Introduction to DevOps | Edureka
Edureka!
 
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
Tableau Tutorial for Data Science | Edureka
Edureka!
 
Python Programming Tutorial | Edureka
Edureka!
 
Top 5 PMP Certifications | Edureka
Edureka!
 
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
Linux Mint Tutorial | Edureka
Edureka!
 
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
Importance of Digital Marketing | Edureka
Edureka!
 
RPA in 2020 | Edureka
Edureka!
 
Email Notifications in Jenkins | Edureka
Edureka!
 
EA Algorithm in Machine Learning | Edureka
Edureka!
 
Cognitive AI Tutorial | Edureka
Edureka!
 
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
Blue Prism Top Interview Questions | Edureka
Edureka!
 
Big Data on AWS Tutorial | Edureka
Edureka!
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
Introduction to DevOps | Edureka
Edureka!
 
Ad

Recently uploaded (20)

PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PPTX
Designing Production-Ready AI Agents
Kunal Rai
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Designing Production-Ready AI Agents
Kunal Rai
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 

Angular Directives | Angular 2 Custom Directives | Angular Tutorial | Angular Training | Edureka

  • 2. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Agenda ❖ Why we need Angular Directive? ❖ What is Angular Directive? ❖ Types of Angular Directive ❖ Built-in Angular Directives ❖ Working with Custom Angular Directives
  • 3. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Why We Need Angular Directive?
  • 4. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Component 1 Component 2 { } { } Component 4 Component … Component 3 Component … { } { } { } { } Why we need Directive? Component 1 Component 2 { } { } Component 4 Component … Component 3 Component … { } { } { } { } Changing code for Component 1 Similarly changing code for each components individually…
  • 5. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Component 1 Component 2 { } { } Component 4 Component … Component 3 Component … { } { } { } { } Component 1 Component 2 { } { } Component 4 Component … Component 3 Component … { } { } { } { } DirectiveCreate a with required behavior Just Import the Directive to all Components Directives can be imported anywhere providing similar functionality Directive Directive Directive Directive Directive Directive Why we need Directive?
  • 6. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Why we need Directive? Code modular & manageable Reusable code Separating that code out from the view, helps developer to focus on UI and application logic separately Available as a stand-alone reusable unit
  • 7. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js What is Angular Directive?
  • 8. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Directives Introduction Directives extend HTML with new attributes DOM is transformed according to directives instructions Appear within an element tag
  • 9. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Directives Introduction Angular provides a set of built-in directives which offers functionality Create custom directives A directive is a class with a @Directive decorator
  • 10. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Types of Angular Directive
  • 11. www.edureka.co/angular-jsEDUREKA ANGULAR-JS CERTIFICATION TRAINING Types of Angular Directives Components 1 Structural Directives 2 Attributes Directive 3 Directives with a template Adds & removes DOM elements to change DOM layout Changes the appearance or behavior of an element
  • 12. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Component Directive @Component decorator is a @Directive decorator extended with template-oriented features A component is technically a directive-with-a-template
  • 13. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Structural Directives Structural directives alter layout by adding, removing, and replacing elements in DOM. *ngFor tells Angular to stamp out one <li> per course in the courses list. *ngIf includes the CourseDetail component only if a selected course exists
  • 14. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Attribute Directives Attribute Directive alter the appearance or behavior of an existing element Displays value property and responds to changing events ngModel modifies the behavior of an existing element
  • 15. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Built-In Angular Directives
  • 16. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Built-in Angular Directives NgStyle NgIf NgSwitch NgFor NgClass NgClass is used for class binding – adding or removing several classes Adding an NgClass property binding sets the element's classes accordingly
  • 17. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Built-in Angular Directives NgStyle NgIf NgSwitch NgFor NgClass NgStyle helps in style binding NgStyle directive is a better choice while setting many inline styles
  • 18. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Built-in Angular Directives NgStyle NgIf NgSwitch NgFor NgClass Adds an element subtree to the DOM by binding an NgIf directive Binding to a false expression removes the element subtree from the DOM VISIBILITY AND NGIF ARE NOT THE SAME
  • 19. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Built-in Angular Directives NgStyle NgIf NgSwitch NgFor NgClass NgSwitch displays one element from a set of element trees based on conditions Returns a switch value
  • 20. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Built-in Angular Directives NgStyle NgIf NgSwitch NgFor NgClass At any particular moment, at most one of these spans is in the DOM 3 collaborating directives are at work here: ngSwitch 1 ngSwitchCase 2 ngSwitchDefault 3 bound to an expression that returns the switch value bound to an expression returning a match value a marker attribute on the default element
  • 21. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Built-in Angular Directives NgStyle NgIf NgSwitch NgFor NgClass NgFor is a repeater directive - presents a list of items
  • 22. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js * and template * modify HTML layout with the help of templates NgFor, NgIf, and NgSwitch adds and removes elements
  • 23. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Custom Attribute Directive
  • 24. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Custom Attribute Directive Directive
  • 25. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Custom Attribute Directive provides the functionality of the @Directive decorator.
  • 26. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Custom Attribute Directive It can access the DOM element
  • 27. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Custom Attribute Directive Subscribe to events of the DOM element
  • 28. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Custom Attribute Directive Allows data to flow from the binding expression into the directive
  • 29. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Custom Attribute Directive Contains the directive metadata in a configuration object
  • 30. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Custom Attribute Directive Identifies the HTML in the template that is associated with the directive
  • 31. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Custom Attribute Directive Directive Class that performs operation
  • 32. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Custom Attribute Directive Grants direct access to the DOM element through its nativeElement property
  • 33. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Custom Attribute Directive Listens to the event and perform accordingly
  • 34. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Custom Structural Directive
  • 35. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Hands-On
  • 36. EDUREKA ANGULARJS CERTIFICATION TRAINING www.edureka.co/angular-js Thank You … Questions/Queries/Feedback