SlideShare a Scribd company logo
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Edureka
Free Angular Course For Beginner
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Angular Tutorial - Road Covered So Far
Angular
Introduction
Angular Install &
Project Structure
Angular
Components
Angular
Data Binding
Angular
Directives
Angular &
angularFirebase
Angular
CRUD App
Angular
Services
Angular
Forms
Angular
Routing
1
10 9 8 7 6
1 2 3 4 5
678910
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
What is a Directive?
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
What is Directive?
Angular templates are dynamic. When Angular renders them, it transforms the DOM according
to the instructions given by Directives.
Directives
DOM Tree
manipulates
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Types of Angular Directives
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Types of Data Binding
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
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Built-in Structural Directive
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Built-in Structural Directives
Structural Directives
2
Adds & removes DOM elements to change DOM layout
NgFor NgIf NgSwitch
a b c
Adds or Removes an element
from the DOM
Repeater directive that iterates
over collection of data
Displays one element out of multiple
elements based on a switch condition
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Built-in Attribute Directive
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Built-in Attribute Directives
Structural Directives
2
Attribute Directives
3
Changes the appearance or behavior of an element
NgStyle NgClass NgModel
a b c
Adds and Removes CSS
classes dynamically
Sets inline styles dynamically based
on the state of the component
Displays a data property and updates it
as per the user interaction
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Creating Custom Directive
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Why we need Directives?
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Why we need Directives?
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
Angular 4 Directives | Angular 4 Tutorial For Beginners | Angular 4 Directives Example | Edureka

More Related Content

Similar to Angular 4 Directives | Angular 4 Tutorial For Beginners | Angular 4 Directives Example | Edureka (20)

PPTX
Angular Directive.pptx
AshokKumar616995
 
PPTX
Introduction to AngularJs
Ahmed Elharouny
 
PDF
Angular 4 Data Binding | Two Way Data Binding in Angular 4 | Angular 4 Tutori...
Edureka!
 
PDF
Angular Directives | Angular 2 Custom Directives | Angular Tutorial | Angular...
Edureka!
 
PDF
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | Edureka
Edureka!
 
PPTX
Step by Step - AngularJS
Infragistics
 
PDF
Infosys Angular Interview Questions PDF By ScholarHat
Scholarhat
 
PDF
React Redux Tutorial | Redux Tutorial for Beginners | React Redux Training | ...
Edureka!
 
PDF
Django Tutorial | Django Web Development With Python | Django Training and Ce...
Edureka!
 
PPTX
Angular Framework.pptx
varshadixit10
 
PPTX
Angular presentation
merlihan
 
PDF
React Interview Questions and Answers | React Tutorial | React Redux Online T...
Edureka!
 
PDF
[Cisco Connect 2018 - Vietnam] Lam doan software-defined access-a transform...
Nur Shiqim Chok
 
PDF
Cisco Connect 2018 Vietnam - Software-defined access-a transformational appro...
NetworkCollaborators
 
PDF
ReactJS Tutorial For Beginners | ReactJS Redux Training For Beginners | React...
Edureka!
 
PDF
What Is Angular 2 | Angular 2 Tutorial For Beginners | Angular Training | Edu...
Edureka!
 
PDF
What Is React | ReactJS Tutorial for Beginners | ReactJS Training | Edureka
Edureka!
 
PPTX
Angular js firebase-preso
Avinash Kondagunta
 
PPTX
[Cisco Connect 2018 - Vietnam] 2. lam doan software-defined access-a transf...
Nur Shiqim Chok
 
PPTX
Intro to Angular @GDG Wolverhampton DEV-FEST 2024
stephenola21
 
Angular Directive.pptx
AshokKumar616995
 
Introduction to AngularJs
Ahmed Elharouny
 
Angular 4 Data Binding | Two Way Data Binding in Angular 4 | Angular 4 Tutori...
Edureka!
 
Angular Directives | Angular 2 Custom Directives | Angular Tutorial | Angular...
Edureka!
 
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | Edureka
Edureka!
 
Step by Step - AngularJS
Infragistics
 
Infosys Angular Interview Questions PDF By ScholarHat
Scholarhat
 
React Redux Tutorial | Redux Tutorial for Beginners | React Redux Training | ...
Edureka!
 
Django Tutorial | Django Web Development With Python | Django Training and Ce...
Edureka!
 
Angular Framework.pptx
varshadixit10
 
Angular presentation
merlihan
 
React Interview Questions and Answers | React Tutorial | React Redux Online T...
Edureka!
 
[Cisco Connect 2018 - Vietnam] Lam doan software-defined access-a transform...
Nur Shiqim Chok
 
Cisco Connect 2018 Vietnam - Software-defined access-a transformational appro...
NetworkCollaborators
 
ReactJS Tutorial For Beginners | ReactJS Redux Training For Beginners | React...
Edureka!
 
What Is Angular 2 | Angular 2 Tutorial For Beginners | Angular Training | Edu...
Edureka!
 
What Is React | ReactJS Tutorial for Beginners | ReactJS Training | Edureka
Edureka!
 
Angular js firebase-preso
Avinash Kondagunta
 
[Cisco Connect 2018 - Vietnam] 2. lam doan software-defined access-a transf...
Nur Shiqim Chok
 
Intro to Angular @GDG Wolverhampton DEV-FEST 2024
stephenola21
 

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)

PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
July Patch Tuesday
Ivanti
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
July Patch Tuesday
Ivanti
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Ad

Angular 4 Directives | Angular 4 Tutorial For Beginners | Angular 4 Directives Example | Edureka

  • 1. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Edureka Free Angular Course For Beginner
  • 2. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Angular Tutorial - Road Covered So Far Angular Introduction Angular Install & Project Structure Angular Components Angular Data Binding Angular Directives Angular & angularFirebase Angular CRUD App Angular Services Angular Forms Angular Routing 1 10 9 8 7 6 1 2 3 4 5 678910
  • 3. Copyright © 2017, edureka and/or its affiliates. All rights reserved. What is a Directive?
  • 4. Copyright © 2017, edureka and/or its affiliates. All rights reserved. What is Directive? Angular templates are dynamic. When Angular renders them, it transforms the DOM according to the instructions given by Directives. Directives DOM Tree manipulates
  • 5. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Types of Angular Directives
  • 6. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Types of Data Binding 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
  • 7. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Built-in Structural Directive
  • 8. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Built-in Structural Directives Structural Directives 2 Adds & removes DOM elements to change DOM layout NgFor NgIf NgSwitch a b c Adds or Removes an element from the DOM Repeater directive that iterates over collection of data Displays one element out of multiple elements based on a switch condition
  • 9. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Built-in Attribute Directive
  • 10. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Built-in Attribute Directives Structural Directives 2 Attribute Directives 3 Changes the appearance or behavior of an element NgStyle NgClass NgModel a b c Adds and Removes CSS classes dynamically Sets inline styles dynamically based on the state of the component Displays a data property and updates it as per the user interaction
  • 11. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Creating Custom Directive
  • 12. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Why we need Directives?
  • 13. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Why we need Directives? 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