Recall & Review
beginner
What is the purpose of the
@NgModule decorator in Angular?The
@NgModule decorator defines a module in Angular. It organizes related components, directives, pipes, and services into a cohesive block, making the app easier to manage and scale.Click to reveal answer
beginner
Name four main metadata properties inside the
@NgModule decorator.The four main metadata properties are:<br>1. declarations: Components, directives, and pipes that belong to this module.<br>2. imports: Other modules whose exported classes are needed.<br>3. providers: Services available for dependency injection.<br>4. bootstrap: The root component to start the app (usually in the root module).
Click to reveal answer
beginner
What does the
declarations array in @NgModule metadata contain?The
declarations array lists components, directives, and pipes that belong to this module. These are the building blocks that the module manages and can use internally.Click to reveal answer
beginner
Explain the role of the
imports array in @NgModule.The
imports array includes other Angular modules whose exported components, directives, or pipes are needed in this module. It allows sharing features between modules.Click to reveal answer
beginner
What is the function of the
bootstrap property in @NgModule?The
bootstrap property lists the root component(s) that Angular should load when starting the app. It is usually used only in the root module to launch the main UI.Click to reveal answer
Which
@NgModule metadata property is used to declare components, directives, and pipes?✗ Incorrect
The
declarations array is where you list components, directives, and pipes that belong to the module.Where do you specify services that should be available for dependency injection in an Angular module?
✗ Incorrect
The
providers array is used to register services for dependency injection.What is the purpose of the
imports array in @NgModule?✗ Incorrect
The
imports array includes other modules whose exported features are needed.Which
@NgModule property is typically used only in the root module?✗ Incorrect
The
bootstrap property lists the root component to launch the app and is usually only in the root module.Can you declare the same component in multiple Angular modules?
✗ Incorrect
A component can only be declared in one module to avoid conflicts.
Describe the role of the
@NgModule decorator and its main metadata properties in Angular.Think about how Angular organizes code into blocks.
You got /5 concepts.
Explain why the
bootstrap property is important and where it is used.Consider what happens when the app first loads.
You got /3 concepts.