我的开发环境中所有路由都可以正常工作。但是在我捆绑了我的角度2应用程序之后,除了Home Route之外的路线不起作用
这是我的 app.routes.ts配置:
import { provideRouter, RouterConfig } from '@angular/router';
import {HomeComponent} from "./pages/home/home.component";
import {PageNotFoundComponent} from "./pages/page-not-found/pageNotFound.component";
import {TosComponent} from "./pages/tos/tos.component";
import {PrivacyPolicyComponent} from "./pages/privacy-policy/privacyPolicy.component";
import {AboutUsComponent} from "./pages/about-us/abooutUs.component";
import {SubmitNewsComponent} from "./pages/submit-news/submitNews.component";
// Routes Start
export const routes: RouterConfig = [
{path: 'tos', component: TosComponent},
{path: 'privacy-policy', component: PrivacyPolicyComponent},
{path: 'about-us', component: AboutUsComponent},
{path: '', component: HomeComponent},
{path: 'submit-news', component: SubmitNewsComponent},
{ path: '**', component: PageNotFoundComponent }
];
// Routes End`enter code here`
export const APP_ROUTER_PROVIDERS = [
provideRouter(routes)
];
的package.json:
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "concurrently \"npm run tsc:w\" \"npm run lite\" \"compass watch\"",
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"typings": "typings install",
"postinstall": "npm run typings",
"build": "npm run clean && tsc",
"clean": "rm -rf dist",
"build_prod": "npm run build && browserify -s app/main dist/app/main.js > dist/bundle.js && npm run minify",
"minify": "uglifyjs dist/bundle.js --screw-ie8 --compress --mangle --output dist/bundle.min.js"
},