每当我运行npm start
命令时,我的角度都可以正常工作。
但是当我尝试以“ prod” 模式构建它时,我的应用程序什么也不做。 它只显示静态页面。
所有导航链接均停止工作
package.json
{
"name": "srm-roster",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxyconfig.json --port 5555",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~7.0.0",
"@angular/cdk": "~7.0.3",
"@angular/common": "~7.0.0",
-- so on --
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.10.0",
"@angular/cli": "~7.0.3",
"@angular/compiler-cli": "~7.0.0",
"@angular/language-service": "~7.0.0",
"@types/node": "~8.9.4",
-- so on --
}
}
这是我的 app-routing.module.ts 的外观
const routes: Routes = [
{
path: 'dashboard',
component: DashboardComponent
}, {
path: 'rostertable',
component: RostertableComponent
}, {
path: '**',
redirectTo : 'dashboard'
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
答案 0 :(得分:1)