0
0
Angularframework~10 mins

NgModule decorator and metadata in Angular - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the NgModule decorator from Angular core.

Angular
import { [1] } from '@angular/core';
Drag options to blanks, or click blank then click option'
ADirective
BComponent
CInjectable
DNgModule
Attempts:
3 left
💡 Hint
Common Mistakes
Using Component instead of NgModule
Forgetting to import from '@angular/core'
2fill in blank
medium

Complete the code to declare a module class named AppModule.

Angular
@NgModule({})
export class [1] {}
Drag options to blanks, or click blank then click option'
AAppModule
BMainModule
CRootModule
DModuleApp
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-standard module name
Misspelling the class name
3fill in blank
hard

Fix the error in the NgModule metadata by completing the imports array with BrowserModule.

Angular
@NgModule({
  imports: [[1]]
})
export class AppModule {}
Drag options to blanks, or click blank then click option'
AHttpClientModule
BCommonModule
CBrowserModule
DFormsModule
Attempts:
3 left
💡 Hint
Common Mistakes
Using CommonModule instead of BrowserModule in root module
Forgetting to import BrowserModule
4fill in blank
hard

Fill both blanks to declare a component in declarations and bootstrap arrays.

Angular
@NgModule({
  declarations: [[1]],
  bootstrap: [[2]]
})
export class AppModule {}
Drag options to blanks, or click blank then click option'
AAppComponent
BMainComponent
CRootComponent
DHomeComponent
Attempts:
3 left
💡 Hint
Common Mistakes
Using different components in declarations and bootstrap
Forgetting to declare the bootstrap component
5fill in blank
hard

Fill all three blanks to complete the NgModule metadata with imports, declarations, and bootstrap arrays.

Angular
@NgModule({
  imports: [[1]],
  declarations: [[2]],
  bootstrap: [[3]]
})
export class AppModule {}
Drag options to blanks, or click blank then click option'
ABrowserModule
BAppComponent
DCommonModule
Attempts:
3 left
💡 Hint
Common Mistakes
Using CommonModule instead of BrowserModule in imports
Not bootstrapping the declared component