Loading…

Explain the difference between component and directive in angular 2?

  Components Directive
1. To register, use @Component meta-data annotation To register, use @Directive meta-data annotation
2. Used to create UI widgets and break up app into smaller components Use to design re-usable components and add behavior to existing DOM element.
3. Only one component allowed per DOM element Many directives allowed per DOM element.
4. @View decorator is mandatory Does not use View.

Note: This question is frequently asked in every Angular 2 Interview Questions.

Suggest An Answer

No suggestions avaliable!

Latest post from Angular 2 Interview Questions

Ask Question