Bird
0
0

Which of the following is the correct way to import the RouterModule in an Angular module file?

easy📝 Syntax Q3 of 15
Angular - Standalone Components
Which of the following is the correct way to import the RouterModule in an Angular module file?
Aimport RouterModule from '@angular/router';
Bimport { RouterModule } from '@angular/router';
Cimport { RouterModule } from '@angular/core';
Dimport RouterModule from '@angular/common';
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct package for RouterModule

    RouterModule is part of '@angular/router'.
  2. Step 2: Use correct import syntax

    RouterModule is a named export, so use curly braces: import { RouterModule } from '@angular/router';
  3. Final Answer:

    import { RouterModule } from '@angular/router'; -> Option B
  4. Quick Check:

    RouterModule import = '@angular/router' with braces [OK]
Quick Trick: Named exports need curly braces in import statements [OK]
Common Mistakes:
  • Using default import syntax for named exports
  • Importing RouterModule from wrong package

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes