1.

What Are Differences Between Components And Directives?

Answer»

Components : 

  • For register component we use @Component meta-data annotation.
  • Component is a directive which use shadow DOM to create encapsulate visual behavior called components.Components are typically used to create UI widgets.
  • Component is used to BREAK up the application into smaller components.
  • Only one component can be present per DOM element.
  • @View decorator or templateurl template are mandatory in the component.

Directives :

  • For register directives we use @Directive meta-data annotation.
  • Directives is used to ADD behavior to an EXISTING DOM element.
  • Directive is use to DESIGN re-usable components.
  • Many directive can be used in a per DOM element.
  • Directive don’t have View.

Components : 

Directives :



Discussion

No Comment Found