Which Angular CLI command can I use to move a newly created component under a folder?

Viewed 11458

I have created two components in my Angular Project based on the requirement. I need to show these components under a specific folder so that I can relate it easily while working on another modules.Please let me know if there is any command which can fulfill my requirement.

Components are : user-list and user-single Folder Name: Users

enter image description here

4 Answers

These are just some files inside a folder. In windows, you can use the move command to move them to the appropriate directory. Or you can just delete the component, and generate a new one in your required directory. Either way works!

If you're using VSCode, you can move the folder from within Code's Explorer and it is usually smart enough to update the file imports.

I just figured out that moving a component into another folder (eg components) within VS Code will course a real strange compilation problem. Moving that component back where it was does not solve the problem :-/

move your component folder to another folder and go to the app.module.ts and redefine the new location

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HeaderComponent } from './header/header.component';
import { SidebarComponent } from './sidebar/sidebar.component';
import { ToolbarComponent } from './toolbar/toolbar.component';
import { ContentComponent } from './content/content.component';
import { FooterComponent } from './content/footer/footer.component';
Related