我在学习Angular 6
。
我已经按照以下结构以层次结构形式设计了我的应用程序结构。
my_app
|- src
|- app
|- layout
|- admin-layout
|- admin-layout.module.ts
|- admin-layout.routing.ts
|- admin-layout.component.html
|- contacts
|- contact-list
|- contact-list.component.ts
|- contact-list.component.html
|- contacts.module.ts
|- transaction
|- amount-given
|- amount-given-list
|- amount-given-list.component.ts
|- amount-given-list.component.html
|- amount-given.module.ts
|- amount-given.routing.ts
|- amount-given.service.ts
|- transaction.module.ts
|- transaction.routing.ts
|- app.module.ts
|- app.component.html
|- app-routing.module.ts
可以在这里找到源代码和演示图:https : //stackblitz.com/edit/angular-wcglvr
<a routerLink="/dashboard">Dashboard</a>
正在(/transaction/amount-given/amount-given-list/
但不是从)工作/contacts/contact-list
。
由于源代码很长而且很分层,因此我在stackblitz上添加了演示示例。
您还没有进口RouterModule
在ContactsModule
。
import {RouterModule} from '@angular/router';
@NgModule({
imports: [
RouterModule
],
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句