Write the difference between directive and component in angular js.

devquora
devquora

Posted On: Feb 22, 2018

 

In Angular js, there are differences between the meta-data annotations. Some of the differences are:

  • A directive is used to add behavior to an existing element. Whereas, a component is used to create a component with attached behavior.
  • "@directive" is used to create a directive. Whereas, "@component" is used to create a component.
  • A directive is used to attach different behaviors to an existing DOM element. Whereas, with the help of a component, we can break our application into smaller components.
  • A directive is used to create reusable behavior. Whereas, a component is used to create reusable components.
  • A directive does not require a view. Whereas, a component needs a view via @view.

Prepare Latest React js Interview questions 2019

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Angular 4 Interview Questions

    Explain component decorators in Angular4.

    A decorator is the core concept when developing an angular framework with version 2 and above. It may become a core lang..

    Angular 4 Interview Questions

    Write the CLI command to generate a component in Angular4.

    Components are just simple classes which are declared as components with the help of component decorators. It becomes e..

    Angular 4 Interview Questions

    Explain the component directory structure of angular4.

    Here are the elements which are present in the component directory structure anf modules:-module.ts- in this, the angu..