import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { StudentApplicationsComponent } from "./student-applications/student-applications-component";
@NgModule({
imports: [
RouterModule.forRoot([
{
path: 'student', component: StudentApplicationsComponent
}
])
],
exports: [RouterModule]
})
export class StudentRoutingModule { }
export const routingComponents = [StudentApplicationsComponent] ;
有没有导入的studentappmodule
@NgModule({
imports: [
RouterModule,
StudentRoutingModule,
...
],
declarations: [
StudentApplicationsComponent
],
providers: [
]
})
export class StudentModule{
}
答案 0 :(得分:1)
它对我有用。再给它一次运行ng build命令。
答案 1 :(得分:0)
您需要使用在角度1
中使用的哈希策略 RouterModule.forRoot([
{
path: 'student', component: StudentApplicationsComponent
}
],{useHash: true});
另请检查您是否在index.html文件中设置了基本路径
<base href="/">