在我的Angel 15应用程序的一个页面中,我有一台路由可以显示嵌套的路由:
<app-sidebar></app-sidebar>
<ion-router-outlet></ion-router-outlet>
我的app-sidebar
美元在哪里:
<ion-list>
<ion-item *ngFor="let route of profileRoutes">
<ion-button
[routerLink]="route.path"
routerLinkActive="active-item">
{{ route.label }}
</ion-button>
</ion-item>
</ion-list>
和profileRoutes
实现此接口:
export interface ProfileRoute {
path: string;
label: string;
}
下面是我的路由的配置:
const routes = [
{
path: 'profile',
loadComponent: () =>
import('./path-to-component').then(
m => m.Component
),
children: childrenRoutes,
}
]
const childrenRoutes = [
{
path: 'route-1',
loadComponent: () =>
import('path-to-component').then(
m => m.Component
),
},
{
path: 'route-2',
loadComponent: () =>
import('path-to-component').then(
m => m.Component
),
},
...
]
Behavior个
- 点击按钮
route-1
一次,即可正常工作(重定向至/profile/route-1
). - 然后,点击按钮
route-2
,用户不会得到重定向,加上所有按钮获得类active-item
,表示所有路由都被触发为active
. - 如果我右击并"在另一个选项卡中打开",路由就会按预期触发,并且我可以从操作1重新启动.
此外,此警告记录在操作2上.
在即将发布的ANGLE版本中,导航到/Profile/Route-1将改为导航到/Profile/Route-2.可能需要从
UrlCreationOptions
中删除relativeTo
但我从来没有在任何地方用过relativeTo
.
我try 在辅助ion-router-outlet
上添加一个名称,并在childrenRoutes
中的路径上添加outlet
属性,但没有成功.