[英]Angular 9 Unwanted redirect after page reload
我在理解 Angular 路由器行為方面遇到問題。 目前,路由模塊如下所示:
const routes: Routes = [
{
path: '',
component: ManageCompetitionComponent,
children: [
{
path: ':eventID',
component: EventProfileComponent,
},
],
}];
當我打開http://localhost:4200/admin/competition
並單擊導航到http://localhost:4200/admin/competition/1234
的鏈接時,它工作正常,並且EventProfileComponent
顯示為ManageCompetitionComponent
一部分(包含路由器-出口)。
但是當我現在從瀏覽器調用時(例如刷新/F5):
http://localhost:4200/admin/competition -> works fine
http://localhost:4200/admin/competition/1234 -> redirects to /admin/competition
那么我怎樣才能防止這種重定向呢?
嘗試這個,
const routes: Routes = [
{
path: '',
component: ManageCompetitionComponent,
},
{
path: ':eventID',
component: EventProfileComponent,
}];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.