我有这个
TabView
组成部分:
<TabView androidTabsPosition="bottom">
<page-router-outlet *tabItem="{title: 'Item 1'}" name="map"></page-router-outlet>
<page-router-outlet *tabItem="{title: 'Item 2'}" name="subscribe"></page-router-outlet>
</TabView>
路由器配置:
{
path: '',
redirectTo: '/(map:map//subscribe:subscribe)',
pathMatch: 'full'
},
{
path: 'map',
loadChildren: '~/app/routes/+map/map.module#MapModule',
outlet: 'map'
},
{
path: 'subscribe',
loadChildren: '~/app/routes/+subscribe/subscribe.module#SubscribeModule',
outlet: 'subscribe'
}
在功能模块中
SubscribeModule
我有一个功能可以导航到
map
路线:
// The NativeScript router service
constructor(private router: RouterExtensions) {}
navigate(args) {
const item = this.items[args.index];
this.router.navigate(['map'], {
transition: {
name: 'slideLeft',
duration: 300
}
});
}
但我一直得到的是
Error: Cannot match any routes. URL Segment: 'map'
.
我还尝试了以下方法:
-
使用导航到指定的出口
this.router.navigate([{outlets: {map: 'map'}}]
-
导航
this.router.navigate(['../', 'map'])
-
使用导航
navigateByUrl
但它们都会产生相同的结果。
我可能做错了什么?