0

I want to create several components in the same folder. Is there a way in Angular to do so using one command?

A pseudo-command:

ng g c First Component, Second Component, Third Component
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Baruch Gans
  • 1,415
  • 1
  • 10
  • 21
  • Maybe you better to change the architecture of your project. It seems you are going to create too many components, sometimes you can handle these things with few components or even with the component factory – Arash May 05 '19 at 09:12

1 Answers1

4

ng generate doesn't support generating multiple components (or any other schematics) at once. However, you can loop in your shell outside the Angular CLI; for example, in bash:

for COMPONENT in first second third; do ng g c "$COMPONENT"; done
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437