如何在Angular CLI中重命名组件? [英] How to rename a component in Angular CLI?

查看:93
本文介绍了如何在Angular CLI中重命名组件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了手动编辑所有组件文件(例如文件夹名称,.css,.ts,spec.ts和app.module.ts)以外,是否有使用Angular CLI重命名组件的快捷方式?

解决方案

否!

没有命令可以更改使用component create命令生成的所有文件的名称.如此创建的tshtmlcss/scss.spec.ts 文件需要手动重命名/编辑.

我经常使用angular cli,我认为这是一个很好的命令,因为有时我们只是创建角度分量并需要重命名它们.由于不存在此重命名命令,因此删除创建的角度组件,指令等,然后再次运行该命令来创建组件确实很麻烦.

此处是添加此功能的讨论链接,重命名角度分量

Is there any shortcut to rename a component with the Angular CLI other than manually editing all the component files such as folder name, .css, .ts, spec.ts and app.module.ts?

解决方案

No!

There is no command which will change the name of all files generated using the component create command. So created ts, html, css/scss, .spec.ts files need to be manually renamed/edited.

I am a frequent user of angular cli and I think this would be a nice-to-have command as some time we just create angular components and need to rename them. As this rename command is not there, deleting the created angular component, directive, etc and again running the command to create the component is really a pain.

Here is the discussion link to add this feature rename angular component

这篇关于如何在Angular CLI中重命名组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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