Bird
0
0

You ran ng generate component navBar but the CLI created a folder named nav-bar. Why did this happen?

medium📝 Debug Q6 of 15
Angular - Components
You ran ng generate component navBar but the CLI created a folder named nav-bar. Why did this happen?
AThe folder name matches the component class name exactly
BThe CLI has a bug causing random folder names
CAngular CLI converts camelCase names to kebab-case for folder names
DYou must manually specify kebab-case names; CLI does not convert
Step-by-Step Solution
Solution:
  1. Step 1: Understand Angular CLI naming conventions

    Angular CLI automatically converts camelCase component names to kebab-case folder and file names.
  2. Step 2: Analyze the example

    Input navBar becomes folder nav-bar following kebab-case style.
  3. Final Answer:

    Angular CLI converts camelCase names to kebab-case for folder names -> Option C
  4. Quick Check:

    CLI converts camelCase to kebab-case automatically [OK]
Quick Trick: CLI auto-converts camelCase to kebab-case folder names [OK]
Common Mistakes:
  • Thinking CLI creates folders exactly as typed
  • Assuming manual renaming is required
  • Believing this is a CLI bug

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes