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

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

问题描述

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

解决方案

不!

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

我是 angular cli 的常客,我认为这将是一个很好的命令,因为有时我们只是创建 angular 组件并需要重命名它们.由于没有这个重命名命令,删除创建的 angular 组件、指令等并再次运行创建组件的命令真的很痛苦.

这是添加此功能的讨论链接重命名角度组件

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天全站免登陆