是否可以使用单个angular-cli命令生成多个Angular组件,例如ng generate component comp1,comp2,comp3? [英] Is it possible to generate multiple Angular components using single angular-cli command like ng generate component comp1, comp2, comp3?
问题描述
我需要创建十个Angular组件,例如comp1,comp2,comp3,comp4,...,comp10。
因此,我需要对每个组件(例如ng gc comp1,ng gc comp2等)执行相同的命令十次。
I need to create ten Angular components like comp1, comp2, comp3, comp4, ..., comp10. So I need to execute same command for ten times for each component like ng g c comp1, ng g c comp2, etc.
是否存在任何选项使用单个ng-cli命令(例如ng gc comp1,comp2,comp3 )生成多个角度分量。
Is there any option to generate multiple angular components using single angular-cli command like ng g c comp1, comp2, comp3.
推荐答案
,到目前为止,Angular CLI尚未创建任何组件。但这可以在任何shell中轻松完成。
Well, there is nothing as of now by Angular CLI to create multiple components. But this can be done trivially in any shell.
在bash shell中运行此命令-
Run this command into your bash shell -
for i in comp1 comp2; do ng g c "${i}"; done
特别感谢因戈·布尔克(IngoBürk)的答案
这篇关于是否可以使用单个angular-cli命令生成多个Angular组件,例如ng generate component comp1,comp2,comp3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!