Rename / remove / move components
Please provide us with the following information:
- OS? Mac OSX (El Capitan)
- Versions. Please run
ng --version. If there's nothing outputted, please angular-cli: 1.0.0-beta.1 node: 5.7.0 os: darwin x64
It would be really usefull to add cli commands for:
- rm = removing a component
- mv = moving / renaming a component
Unless I am missing it, I don't see that this exists and it would be really useful during refactoring to avoid all the manual updates that come with this process.
Thoughts?
+1
Yes please :)
+1
+10086 for renaming
+1
+1
+1 . I actually need the renaming part as I have just developed my first angular app and I felt the need to refactor it and my IDE was not kind enough to allow me to do that .
+1 It would be a nice feature in angular CLI to have a command for removing/renaming components or modules or pipes etc.,
One solution, although breaks the Angular convention, is to rename the files in each component directory to index.ts, template.html and style.css. That way you can rename just the folder and for imports you can simply import { SomeComponent } from './path/to/dir';.
It's not ideal though, and I would also prefer renaming support. Just the file names is fine, the refactoring can be done in the IDE and is probably out of scope of the CLI anyway.
I also agree, in having a "ng destroy" or "ng remove", when we want to delete a component, so we do not need to delete the file and then also manualy modify the app.module.ts
Hi guys! ✌️
We just wrote a tool to rename angular components. Check it out https://www.npmjs.com/package/ng-rn
Hope you like it 🙃
We just wrote a tool to rename angular components. Check it out https://www.npmjs.com/package/ng-rn
Looks I just had this itching my mind at the right time. Thx!
Any plan to support this in the future? Combining schematics and ngc can be really powerful here..
+1 for moving
Something like -
ng move <component_name> <new_location>
or
ng move <old_component_path> <new_component_path>
+1
@filipesilva Could I develop this feature and submit a pull request, or is it already under development by someone else?
why on earth will i creat a component and not be able to delete... absurd
+1 for ng mv(renaming component), happened to me many times. I always kick off a component with a stupid name, naming is really an art...
Moving can be easily done using many extensions for VS Code, what we need is ng rename to rename a component and also style, html and test files
Hey guys! Just wanted to check on the status of this issue for renaming components (.ts, .html, .css and .spec.ts files as well as the corresponding Component object).
I'd appreciate if anyone could tell me some - I hope, good - news!