Angular

Angular Architecture

Smart vs presentational components, feature modules, core modules, shared modules, monorepo with Nx, folder structure

22 interview questionsยท
Senior
1

What is the main difference between a smart component and a presentational component?

Answer

Smart components (or container components) manage business logic, API calls and application state through services or state management. Presentational components focus solely on display and receive their data via @Input, emitting events via @Output. This separation improves testability and reusability of components.

2

What is the main advantage of using presentational components?

Answer

Presentational components are highly reusable because they don't depend on services or specific business logic. They receive all their data via @Input and communicate via @Output, making them easily testable with mocked data and reusable in different contexts. This approach also encourages using the OnPush strategy for performance optimization.

3

What is a feature module in Angular?

Answer

A feature module is an Angular module that encapsulates a specific business feature of the application (example: user management, shopping cart). It contains all components, services, directives and pipes needed for that feature. Feature modules can be lazy loaded to improve performance and promote a scalable modular architecture.

4

What is the role of a Core Module in Angular architecture?

5

Why import the Core Module only once in AppModule?

+19 interview questions

Master Angular for your next interview

Access all questions, flashcards, technical tests, code review exercises and interview simulators.

Start for free