Component or Directives

Go back to Tutorial

Since as per the above list, component itself act as direcitves. So as a programmer, it is very common to assume that component and direcitves are the same. But actually it is not true. Below the comparison of the Directives and component.

Component Directives
A component is register with the @Component Decorator A Directives is register with the @Directives Decorator
Component is a directive which uses shadow DOM to create encapsulated visual behavior called components. Components are typically used to create UI widgets Directive is used to add behavior to an existing DOM element
Component is used to break up the application into smaller components. Directive is use to design re-usable components.
Only one component can be present per DOM element. Many directives can be used per DOM element.
@View decorator or templateurl template are mandatory in the component. Directive doesn’t use View.

Go back to Tutorial

Get industry recognized certification – Contact us