Bird
0
0

You want to generate multiple components at once inside src/app/widgets folder: button, card, and modal. Which approach is correct?

hard📝 Application Q9 of 15
Angular - Components
You want to generate multiple components at once inside src/app/widgets folder: button, card, and modal. Which approach is correct?
ARun <code>ng generate component widgets/button card modal</code> in one command
BRun three separate commands: <code>ng generate component widgets/button</code>, <code>ng generate component widgets/card</code>, and <code>ng generate component widgets/modal</code>
CCreate a single component named <code>widgets/button-card-modal</code>
DUse <code>ng generate components widgets/button card modal</code> (plural form)
Step-by-Step Solution
Solution:
  1. Step 1: Understand Angular CLI limitations

    Angular CLI does not support generating multiple components in one command.
  2. Step 2: Analyze options

    Only Run three separate commands: ng generate component widgets/button, ng generate component widgets/card, and ng generate component widgets/modal runs separate commands for each component, which is correct.
  3. Final Answer:

    Run three separate commands for each component -> Option B
  4. Quick Check:

    Generate components one at a time with CLI [OK]
Quick Trick: Generate components one by one; CLI does not batch generate [OK]
Common Mistakes:
  • Trying to generate multiple components in one command
  • Using plural 'components' command which is invalid
  • Creating one component with combined name

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes