在Angular2 cli中,我在刷新路线时得到404.
我正在使用这个种子应用:https://github.com/2sic/app-tutorial-angular4-hello-dnn
当我这样做:为jit应用程序服务时,一切正常。
当我执行:https://github.com/2sic/app-tutorial-angular4-hello-dnn时,它可以正常工作。
直到我刷新。
Tech我正在使用:webpack,http-server(运行aot app),typescript,jit和aot build with angular version 4
示例:
导航到定价,定价加载正常,然后点击刷新,你得到404。 我有一个名为'**'的路径,如果路由不存在,它将重定向到归属路由。但是定价路线确实存在,并且它也没有重定向到归属路线。
AOT路由中缺少某种类型的设置吗?
我正在使用http-server ./dist来运行我的应用
这些是我的路线(非延迟加载路线):
import { Routes } from '@angular/router';
import { HomeRoutes } from './components/home/home.routes';
import { ForgotPasswordRoutes } from './components/forgotPassword/forgotPassword.routes';
import { FaqRoutes } from './components/faq/faq.routes';
import { DbsRoutes } from './components/dbs/dbs.routes';
import { PricingRoutes } from './components/pricing/pricing.routes';
import { PrivacyRoutes } from './components/privacy/privacy.routes';
import { TermsRoutes } from './components/terms/terms.routes';
import { SiteMapRoutes } from './components/sitemap/sitemap.routes';
import { AboutRoutes } from './components/about/about.routes';
import { ContactRoutes } from './components/contact/contact.routes';
import { PageNotFoundRoutes } from './components/pageNotFound/pageNotFound.routes';
export const routes: Routes = [
...HomeRoutes,
...ForgotPasswordRoutes,
...FaqRoutes,
...SiteMapRoutes,
...PricingRoutes,
...PrivacyRoutes,
...TermsRoutes,
...AboutRoutes,
...ContactRoutes,
...DbsRoutes,
...PageNotFoundRoutes
];