SlideShare a Scribd company logo
Angular Basics
Angular Directive
In Angular, a directive is a special kind of component that extends the HTML by adding custom
behavior and syntax. Directives allow you to manipulate the Document Object Model (DOM), add
event listeners, and add or remove elements from the DOM.
There are three types of directives in Angular:
 Component Directives: Components are the most common type of directive in Angular and are
used to create reusable UI elements. They have a template, a class, and metadata that describe
how they should be used.
 Structural Directives: Structural directives are used to change the layout of the DOM. Examples
include ngIf, ngFor, and ngSwitch.
 Attribute Directives: Attribute directives are used to change the appearance or behavior of an
element. Examples include ngClass, ngStyle, and ngModel.
Directives are an integral part of Angular and are used to add functionality to your application and
make it more interactive. They allow you to abstract away complex logic and create reusable
components that can be easily shared across your application.
Component Directive
In Angular, a component directive is a reusable UI
element that is defined as a combination of a class, a
template, and metadata that describes how the
component should be used. Components define the
look and behavior of a UI element and can be easily
reused throughout your application.
Here is an example of a component directive in
Angular:
Component Directive
In this example, the component directive is defined using
the @Component decorator, which provides the
metadata for the component. The selector property of
the metadata is used to define a CSS selector that can be
used to include the component in the HTML template of
another component.
The template property defines the HTML template for
the component, and the styles property defines any
styles that should be applied to the component. The
component also has a class, MyComponent, which
defines the data and behavior for the component.
To use the component in your application, you would
include it in the template of another component:
Attribute Directive
In Angular, an attribute directive is a directive that changes the appearance or behavior of an
element. Attribute directives are used to add dynamic behavior to an element, such as changing its
style or handling an event.
Examples include ngClass, ngStyle, and ngModel.
 ngStyle :
In Angular, the ngStyle directive is used to dynamically set styles on an HTML element. It allows you
to bind a JavaScript object to an HTML element's style attribute, so that the styles are automatically
updated whenever the object changes.
Here is an example of using the ngStyle directive in Angular:
Attribute Directive
In this example, the ngStyle directive is used to bind an object with two properties, backgroundColor
and fontSize, to the style attribute of a div element. The values of the backgroundColor and fontSize
properties are used to set the background-color and font-size styles of the element, respectively.
To use this example in your application, you would define the backgroundColor and fontSize
properties in your component and bind them to the ngStyle directive:
To use this example in your application, you would define the backgroundColor and fontSize
properties in your component and bind them to the ngStyle directive:
Attribute Directive
This would render a yellow div element with a font size of 20 pixels. If you later change the values of
the backgroundColor or fontSize properties in your component, the styles of the div element would
be automatically updated to reflect the changes.
Attribute Directive
Attribute Directive
Attribute Directive
In Angular, the ngClass directive is used to dynamically set CSS classes on an HTML element. It allows
you to bind a JavaScript object or an expression to the class attribute of an element, so that the
classes are automatically updated whenever the object or expression changes.
Here is an example of using the ngClass directive with an object in Angular:
Attribute Directive
Attribute Directive
Structural Directive
 NgFor
The ngFor directive is used in Angular to render a list of items in a template. The directive is used with
a * (asterisk) symbol before the keyword ngFor, and it takes an expression that specifies the data
source and the local variable that will be used to reference each item in the list.
Here's an example of how you could use ngFor to display a list of names:
Structural Directive
 ngIf
The ngIf directive in Angular is used to conditionally render elements in the HTML template based on
a boolean expression. It allows you to display or hide an element based on the truthiness of an
expression.
Structural Directive
 ngSwitch
The ngSwitch directive in Angular is used to conditionally render elements in the HTML template
based on a switch expression. It allows you to choose one of several templates to display based on
the value of an expression.
Here is a simple example of how to use the ngSwitch directive:
Custom Directive
 custom Directive
Creating a custom directive in Angular is a simple process. You can use the @Directive decorator to
define a directive, and then you can use it in your HTML template.
Here is an example of a simple custom directive in Angular:
Custom Directive
This directive adds mouse event listeners to the
host element, which is the element the
directive is attached to, and sets the
background color to yellow when the mouse
enters and to null when the mouse leaves. The
directive can be used in your HTML template
like this:
Custom Directive
Parameterized Directive
In Angular, a parameterized directive is a
directive that accepts inputs or parameters
from the user to modify its behavior. This allows
for greater customization and reusability of the
directive.
Questions ?
Thank You

More Related Content

Similar to Angular Directive.pptx

Directives
DirectivesDirectives
Directives
Brajesh Yadav
 
Angular js 1.3 presentation for fed nov 2014
Angular js 1.3 presentation for fed   nov 2014Angular js 1.3 presentation for fed   nov 2014
Angular js 1.3 presentation for fed nov 2014
Sarah Hudson
 
Angular Directives
Angular DirectivesAngular Directives
Angular Directives
Malla Reddy University
 
Lesson 06 Styles and Templates in WPF
Lesson 06 Styles and Templates in WPFLesson 06 Styles and Templates in WPF
Lesson 06 Styles and Templates in WPF
Quang Nguyễn Bá
 
Get Information about Angular Component- Technical Chamber.pdf
Get Information about Angular Component- Technical Chamber.pdfGet Information about Angular Component- Technical Chamber.pdf
Get Information about Angular Component- Technical Chamber.pdf
Nishaadequateinfosof
 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseAngular Js Get Started - Complete Course
Angular Js Get Started - Complete Course
EPAM Systems
 
Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to Angularjs
Gaurav Agrawal
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
Ran Wahle
 
angularJs Workshop
angularJs WorkshopangularJs Workshop
angularJs Workshop
Ran Wahle
 
Angular js
Angular jsAngular js
Angular js
Ramakrishna kapa
 
Angular interview questions
Angular interview questionsAngular interview questions
Angular interview questions
Goa App
 
Angular.pptx
Angular.pptxAngular.pptx
Angular.pptx
Govardhan Bhavani
 
Angular2
Angular2Angular2
Angular Interview Questions & Answers
Angular Interview Questions & AnswersAngular Interview Questions & Answers
Angular Interview Questions & Answers
Ratnala Charan kumar
 
introduction to Angularjs basics
introduction to Angularjs basicsintroduction to Angularjs basics
introduction to Angularjs basics
Ravindra K
 
Leveling up with AngularJS
Leveling up with AngularJSLeveling up with AngularJS
Leveling up with AngularJS
Austin Condiff
 
Angular js interview question answer for fresher
Angular js interview question answer for fresherAngular js interview question answer for fresher
Angular js interview question answer for fresher
Ravi Bhadauria
 
Angularjs Basics
Angularjs BasicsAngularjs Basics
Angularjs Basics
Anuradha Bandara
 
Dive into Angular, part 1: Introduction
Dive into Angular, part 1: IntroductionDive into Angular, part 1: Introduction
Dive into Angular, part 1: Introduction
Oleksii Prohonnyi
 
AngularJS in practice
AngularJS in practiceAngularJS in practice
AngularJS in practice
Eugene Fidelin
 

Similar to Angular Directive.pptx (20)

Directives
DirectivesDirectives
Directives
 
Angular js 1.3 presentation for fed nov 2014
Angular js 1.3 presentation for fed   nov 2014Angular js 1.3 presentation for fed   nov 2014
Angular js 1.3 presentation for fed nov 2014
 
Angular Directives
Angular DirectivesAngular Directives
Angular Directives
 
Lesson 06 Styles and Templates in WPF
Lesson 06 Styles and Templates in WPFLesson 06 Styles and Templates in WPF
Lesson 06 Styles and Templates in WPF
 
Get Information about Angular Component- Technical Chamber.pdf
Get Information about Angular Component- Technical Chamber.pdfGet Information about Angular Component- Technical Chamber.pdf
Get Information about Angular Component- Technical Chamber.pdf
 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseAngular Js Get Started - Complete Course
Angular Js Get Started - Complete Course
 
Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to Angularjs
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
 
angularJs Workshop
angularJs WorkshopangularJs Workshop
angularJs Workshop
 
Angular js
Angular jsAngular js
Angular js
 
Angular interview questions
Angular interview questionsAngular interview questions
Angular interview questions
 
Angular.pptx
Angular.pptxAngular.pptx
Angular.pptx
 
Angular2
Angular2Angular2
Angular2
 
Angular Interview Questions & Answers
Angular Interview Questions & AnswersAngular Interview Questions & Answers
Angular Interview Questions & Answers
 
introduction to Angularjs basics
introduction to Angularjs basicsintroduction to Angularjs basics
introduction to Angularjs basics
 
Leveling up with AngularJS
Leveling up with AngularJSLeveling up with AngularJS
Leveling up with AngularJS
 
Angular js interview question answer for fresher
Angular js interview question answer for fresherAngular js interview question answer for fresher
Angular js interview question answer for fresher
 
Angularjs Basics
Angularjs BasicsAngularjs Basics
Angularjs Basics
 
Dive into Angular, part 1: Introduction
Dive into Angular, part 1: IntroductionDive into Angular, part 1: Introduction
Dive into Angular, part 1: Introduction
 
AngularJS in practice
AngularJS in practiceAngularJS in practice
AngularJS in practice
 

Recently uploaded

UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
ViralQR
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
 

Angular Directive.pptx

  • 2. Angular Directive In Angular, a directive is a special kind of component that extends the HTML by adding custom behavior and syntax. Directives allow you to manipulate the Document Object Model (DOM), add event listeners, and add or remove elements from the DOM. There are three types of directives in Angular:  Component Directives: Components are the most common type of directive in Angular and are used to create reusable UI elements. They have a template, a class, and metadata that describe how they should be used.  Structural Directives: Structural directives are used to change the layout of the DOM. Examples include ngIf, ngFor, and ngSwitch.  Attribute Directives: Attribute directives are used to change the appearance or behavior of an element. Examples include ngClass, ngStyle, and ngModel. Directives are an integral part of Angular and are used to add functionality to your application and make it more interactive. They allow you to abstract away complex logic and create reusable components that can be easily shared across your application.
  • 3. Component Directive In Angular, a component directive is a reusable UI element that is defined as a combination of a class, a template, and metadata that describes how the component should be used. Components define the look and behavior of a UI element and can be easily reused throughout your application. Here is an example of a component directive in Angular:
  • 4. Component Directive In this example, the component directive is defined using the @Component decorator, which provides the metadata for the component. The selector property of the metadata is used to define a CSS selector that can be used to include the component in the HTML template of another component. The template property defines the HTML template for the component, and the styles property defines any styles that should be applied to the component. The component also has a class, MyComponent, which defines the data and behavior for the component. To use the component in your application, you would include it in the template of another component:
  • 5. Attribute Directive In Angular, an attribute directive is a directive that changes the appearance or behavior of an element. Attribute directives are used to add dynamic behavior to an element, such as changing its style or handling an event. Examples include ngClass, ngStyle, and ngModel.  ngStyle : In Angular, the ngStyle directive is used to dynamically set styles on an HTML element. It allows you to bind a JavaScript object to an HTML element's style attribute, so that the styles are automatically updated whenever the object changes. Here is an example of using the ngStyle directive in Angular:
  • 6. Attribute Directive In this example, the ngStyle directive is used to bind an object with two properties, backgroundColor and fontSize, to the style attribute of a div element. The values of the backgroundColor and fontSize properties are used to set the background-color and font-size styles of the element, respectively. To use this example in your application, you would define the backgroundColor and fontSize properties in your component and bind them to the ngStyle directive: To use this example in your application, you would define the backgroundColor and fontSize properties in your component and bind them to the ngStyle directive:
  • 7. Attribute Directive This would render a yellow div element with a font size of 20 pixels. If you later change the values of the backgroundColor or fontSize properties in your component, the styles of the div element would be automatically updated to reflect the changes.
  • 10. Attribute Directive In Angular, the ngClass directive is used to dynamically set CSS classes on an HTML element. It allows you to bind a JavaScript object or an expression to the class attribute of an element, so that the classes are automatically updated whenever the object or expression changes. Here is an example of using the ngClass directive with an object in Angular:
  • 13. Structural Directive  NgFor The ngFor directive is used in Angular to render a list of items in a template. The directive is used with a * (asterisk) symbol before the keyword ngFor, and it takes an expression that specifies the data source and the local variable that will be used to reference each item in the list. Here's an example of how you could use ngFor to display a list of names:
  • 14. Structural Directive  ngIf The ngIf directive in Angular is used to conditionally render elements in the HTML template based on a boolean expression. It allows you to display or hide an element based on the truthiness of an expression.
  • 15. Structural Directive  ngSwitch The ngSwitch directive in Angular is used to conditionally render elements in the HTML template based on a switch expression. It allows you to choose one of several templates to display based on the value of an expression. Here is a simple example of how to use the ngSwitch directive:
  • 16. Custom Directive  custom Directive Creating a custom directive in Angular is a simple process. You can use the @Directive decorator to define a directive, and then you can use it in your HTML template. Here is an example of a simple custom directive in Angular:
  • 17. Custom Directive This directive adds mouse event listeners to the host element, which is the element the directive is attached to, and sets the background color to yellow when the mouse enters and to null when the mouse leaves. The directive can be used in your HTML template like this:
  • 18. Custom Directive Parameterized Directive In Angular, a parameterized directive is a directive that accepts inputs or parameters from the user to modify its behavior. This allows for greater customization and reusability of the directive.