提前感谢您的任何帮助!!!!
你好,正如标题所说。我收到了以下错误....我正在尝试做一堆研究并弄清楚,但我做的任何事情似乎都有效。以下是一些重要文件,有没有人有这个问题的经验或看到问题? (此外错误来自ng服务和ng构建,但是ng服务它首先失败然后自动重建并且工作完美。所以它确实适用于ng服务但是因为第一个是失败我不能建立它(显然是主要问题)
ERROR in Could not resolve "patient.module" from "d:/Downloads/AngularApp/AngularApp/src/app/app.module.ts".
app.routing.ts
const patientRoutes: Routes = [
{
path: 'patient',
loadChildren: 'app/patient/patient.module.ts#PatientModule',
}
];
const nurseRoutes: Routes = [
{
path: 'nurse',
loadChildren: 'app/nurse/nurse.module.ts#NurseModule',
}
];
const appRoutes: Routes = [
{
path: '',
redirectTo: 'auth',
pathMatch: 'full'
},
{
path: 'auth',
component: AutenticationComponent
},
...patientRoutes,
...nurseRoutes
];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes, {useHash: true});
patient.module.ts
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { patientRouting } from './patient.routing';
import { PatientDashboardComponent } from './dashboard/patient-dashboard.component';
@NgModule({
imports: [
CommonModule,
patientRouting
],
declarations: [
PatientDashboardComponent
]
})
export class PatientModule { }
patient.routing.ts
import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { PatientComponent } from './patient.component';
import { PatientDashboardComponent } from './dashboard/patient-dashboard.component';
import { PatientVideoComponent } from './video/video-chat.component';
const patientRoutes: Routes = [
{
path: 'patient',
component: PatientComponent,
children: [
{
path: '',
component: PatientVideoComponent,
children: [
{
path: '',
component: PatientDashboardComponent,
}
]
}
]
}
];
export const patientRouting: ModuleWithProviders = RouterModule.forChild(patientRoutes);
angularcli.json
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": ["assets"],
"index": "index.html",
"main": "main.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "app",
"mobile": false,
答案 0 :(得分:2)
我终于在此找到了一些东西,这似乎有效。他们改变了他们的路由结构,而不是说app / patient直接使用./patient例如。
答案 1 :(得分:0)
应用程序/ DIR1 / DIR2 /...
(假设路径模块在app目录中配置)到 ./dir1/dir2 /...
可以解决这个问题:
const routes: Routes = [
{
path:'customers',
loadChildren: './customers/customers.module#CustomersModule'
},
{
path: 'orders',
loadChildren: './orders/orders.module#OrdersModule'
},
{
path:'contacts',
loadChildren:'./contacts/contacts.module#ContactsModule'
},
{
path:'',
redirectTo:'',
pathMatch:'full'
}
];