Answers for "use component as directive angular"

3

angular directive vs component

Components ARE Directives. 
They are an extenison of directives with their own template and features.
They are used for different things. Main differences:

Components:
- Have their own shadow DOM (an encapsulated template).
- Only one component can be present per DOM element.
- Used represent the core behaviour of DOM element.

Directives:
- Used to add behavior to an existing DOM element.
- Used to design re-usable components.
- Many directives can be used per DOM element.
Posted by: Guest on May-23-2021
-1

directives in angular

content_copy
      
      <!-- toggle the "special" class on/off with a property -->
<div [ngClass]="isSpecial ? 'special' : ''">This div is special</div>
Posted by: Guest on September-30-2021

Code answers related to "use component as directive angular"

Browse Popular Code Answers by Language