[英]what is the best folder structure for parent and child components in angular
Above picture is the implementing structure of parent and child components.上图是父子组件的实现结构。 I have an idea about angular basic folder structure, but I need some small clarifications.
我对 angular 基本文件夹结构有一个想法,但我需要一些小的说明。 Below I have mentioned the structure that I have created currently
下面我提到了我目前创建的结构
app
├── features
│ └── feature 1
│ ├── parent A
│ │ └── parentA.component.ts
│ │
│ ├── parent B
│ │ └── parentB.component.ts
│ │
│ ├── shared
│ │ └── models(models that are using inside the Feature 1)
│ └── core
│ └── service Q
│
├── shared
│ ├── components
│ │ └── header
| └── models(models that are use inside every feature)
└── core
└── service R
My questions are:我的问题是:
Answer 1. You can create your child components below parent A folder and should add routing module for parent A folder.答案 1. 您可以在父 A 文件夹下创建子组件,并应为父 A 文件夹添加路由模块。 Answer 2. Yes, if your shared and core module's usage is limited to feature module then you can absolutely go with your current flow.
答案 2. 是的,如果您的共享和核心模块的使用仅限于功能模块,那么您绝对可以使用当前流程。
app ├── features │ └── feature 1 │ ├── parent A │ │ └── child Aa │ │ └── childAa.component.ts │ │ └── child Ab │ │ └── childAb.component.ts │ │ └── parent A-routing-module.ts │ │ │ ├── parent B │ │ └── parentB.component.ts │ │ │ ├── shared │ │ └── models(models that are using inside the Feature 1) │ └── core │ └── service Q │ ├── shared │ ├── components │ │ └── header | app ├── features │ └── feature 1 │ ├── parent A │ │ └── child Aa │ │ └── childAa.component.ts │ │ └── child Ab │ │ └── childAb.component. ts │ │ └── parent A-routing-module.ts │ │ │ ├── parent B │ │ └── parentB.component.ts │ │ │ ├── shared │ │ └── 模型(使用的模型) Feature 1) │ └── core │ └── service Q │ ├── shared │ ├── components │ │ └── header | └── models(models that are used inside every feature) └── core └── service R
└──模型(在每个特征中使用的模型) └── 核心 └── 服务 R
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.