简体   繁体   中英

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

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

在此处输入图像描述

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!

如果您使用 VSCode,您可以从 Code 的资源管理器中移动文件夹,它通常足够智能以更新文件导入。

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';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM