Bird
0
0

Which of the following is the correct syntax to generate a component named header using Angular CLI?

easy📝 Syntax Q12 of 15
Angular - Components
Which of the following is the correct syntax to generate a component named header using Angular CLI?
Ang generate component header
Bng generate component-header
Cng generate component:header
Dng generate component/header
Step-by-Step Solution
Solution:
  1. Step 1: Check the correct command format

    The Angular CLI expects the component name as a simple argument after the command.
  2. Step 2: Identify the valid component name format

    Component names should be simple words or camelCase without special characters like ':' or '/'.
  3. Final Answer:

    ng generate component header -> Option A
  4. Quick Check:

    Use space, not symbols, between command and name [OK]
Quick Trick: Use space after 'component' for name, no symbols [OK]
Common Mistakes:
  • Using symbols like ':' or '/' in component name
  • Hyphenating the command instead of the name
  • Confusing command syntax with file paths

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes