Return to site

ANGULAR INTERVIEW QUESTION: Can you define what is a component in Angular?📦

· ngInterview,fullstack

ANGULAR INTERVIEW QUESTION: Can you define what is a component in Angular?📦

A component is the most basic element🧬 of user interface in an Angular Application.

Furthermore, an Angular application can be viewed like a plain components tree.📦🌳

More precisely, a component is always composed of

―a TypeScript class for the business logic👨‍💼, with an @Component annotation, and of

―an HTML template🎨.

👇👇👇

Component snippet:

 

 

 

A component must always belong to a module to be used in your application or in another module.

👇👇👇

Module snippet: