我希望路由器路由到不同的组件视图。这些组件通过另一个模块app-module.ts
导入到student-module.ts
中。但是,当我尝试在app-module.ts
中包含的路由器中引用它们时,VSCode指示错误并建议从不导入组件。
file structure
> src/
> app/
app.module.ts
> student/
> student.module.ts
> studentcomponent/
> student.component.ts
这是app.module.ts
...
import { StudentModule } from './student/student.module';
...
// without importing components named below, VScode indicates error here and suggest that I import them here
const appRoutes: Routes = [
{ path: 'student', component: StudentDashboardComponent },
{ path: 'student/courses', component: StudentCoursesComponent },
{ path: 'student/coursehistory', component: CoursehistoryComponent}
];