1.

What is the difference between directive and component in Angular 2?

Answer»
 ComponentsDirective
1.To REGISTER, USE @Component meta-data annotationTo register, use @Directive meta-data annotation
2.Used to create UI widgets and break up app into smaller componentsUse to design re-usable components and add behavior to EXISTING DOM element.
3.Only one component allowed per DOM elementMany DIRECTIVES allowed per DOM element.
4.@VIEW decorator is mandatoryDoes not use View.
Also Read: Angular 6 Question and Answers


Discussion

No Comment Found