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   

Component    

Directive

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)

1
What are components?
2
What are directives?
3
What are the key components of Angular?
4
What is Angular Framework?
5
What is the difference between promise and observable?