我在index.html中使用PathLocationStrategy和<base href="/">
。
当我进入一个像产品细节的孩子路线,如果我尝试刷新页面,我得到错误:无法匹配任何路线,如果我使用浏览器返回和转发。
我是否需要切换到HashLocationStrategy来处理刷新?
这是儿童路线。
import { Route } from '@angular/router';
import { CustomerDetailComponent } from './index';
export const CustomerDetailRoutes: Route[] = [
{
path: 'customer-detail/:code',
component: CustomerDetailComponent
},
];
这是父路线
import { DashboardComponent } from './index';
export const DashboardRoutes: Route[] = [
{
path: 'dashboard',
component: DashboardComponent,
children: [
...HomeRoutes,
...HotelRoutes,
...UserDetailRoutes,
...TicketTypeRoutes,
...TicketBlockRoutes,
...TransitCertificateRoutes,
...TemplateDetailRoutes,
...DepositReceiptRoutes,
...TemplateRoutes,
...LicensePlateDetailRoutes,
...DepositReceiptDetailRoutes,
...LicensePlatesRoutes,
...CustomerDetailRoutes,
]
}
];