简体   繁体   English

我可以使用哪个 Angular CLI 命令将新创建的组件移动到文件夹下?

[英]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.我根据要求在我的 Angular 项目中创建了两个组件。 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. 在Windows中,可以使用move命令将它们移动到适当的目录。 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.我刚刚发现将一个组件移动到 VS Code 中的另一个文件夹(例如组件)会导致一个真正奇怪的编译问题。 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将您的组件文件夹移动到另一个文件夹,并将 go 移动到 app.module.ts 并重新定义新位置

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Angular组件的Assets文件夹下的单独文件中调用外部Javascript函数? - How to call external Javascript function which is in separate file under assets folder in Angular component? 如何清除在组件生命周期中创建的setTimeout? - How can I clear a setTimeout which is created on a component life cycle? 如何使用函数回调设置新创建的元素属性? - How can i use a function callback for setting a newly created element attribute? Angular + PHP文件上传(无法发送新创建的属性) - Angular + PHP file upload (can't sent newly created properties) 如何使用带有角度cli的自举网格? - How can I use bootstrap grid with angular cli? 如何在 Angular CLI 组件中添加外部 JS 文件,仅特定于该组件? - How can I add external JS file in Angular CLI component, specific to the component only? 我可以使用角度组件选择器作为该组件的属性吗? - Can I use an angular component selector as an attribute for that component? 我可以在Angular的另一个组件内部使用组件吗? - Can I use component inside another component in Angular? Angular-cli:如何访问资产文件夹之外的图像 - Angular-cli: How can I access images outside of the assets folder 如何动态移动 <tr> 进入新创建的 <div> ? - How to dynamically move <tr> into a newly created <div>?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM