Angular Interview questions

Total available count: 96
Subject - JavaScript Frameworks
Subsubject - Angular

What are the differences between Component and Directive?

In a short note, A component(@component) is a directive-with-a-template.
Some of the major differences are mentioned in a tabular form   



To register a component we use @Component meta-data annotation

 To register directives we use @Directive meta-data annotation

Components are typically used to create UI widgets

A directive is used to add behavior to an existing DOM element

The component is used to break up the application into smaller components

A directive is used 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 is mandatory

Directives don't use View


Next 5 interview question(s)

What are components?
What are directives?
What are the key components of Angular?
What is Angular Framework?
What is the difference between promise and observable?