是否可以使用单个 angular-cli 命令(如 ng generate component comp1、comp2、comp3)生成多个 Angular 组件? [英] Is it possible to generate multiple Angular components using single angular-cli command like ng generate component comp1, comp2, comp3?

查看:16
本文介绍了是否可以使用单个 angular-cli 命令(如 ng generate component comp1、comp2、comp3)生成多个 Angular 组件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建十个 Angular 组件,例如 comp1、comp2、comp3、comp4、...、comp10.所以我需要为每个组件执行十次相同的命令,例如 ng g c comp1、ng g c 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.

是否有使用单个 angular-cli 命令(如 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

特别感谢 Ingo Bürk 的回答

这篇关于是否可以使用单个 angular-cli 命令(如 ng generate component comp1、comp2、comp3)生成多个 Angular 组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆