ionic-team / ionic-team/ionic-framework

bug: angular, tabs does not support root path (without /tabs)

未关闭
#16,949 17 条评论 12 个 reaction 已指派 0 人 在 GitHub 查看
package: angular type: bug
主要语言
TypeScript
星标
52.7k
派生
13.3k
平均合并
1 天 15 小时
30 天内合并 PR
51

描述

# Bug Report

**Ionic version:**
[x] **4.x**

**Current behavior:**
Using the `ion-tabs` component, clicking on `ion-tab-button`s redirect to wrong URL when trying to remove `/tabs` from `tabs.router.module.ts`.

**Expected behavior:**
Clicking on one `ion-tab-button` should redirect to correct URL.

**Steps to reproduce:**
1. Start a new Ionic Angular project (`ionic start tabs-issue tabs --type=angular`)
2. Remove `/tabs` path from `tabs.router.module.ts` (see related code)
3. Start the app
4. Try navigating from one tab to another

**Related code:**
```javascript
const routes: Routes = [
{
path: '',
component: TabsPage,
children: [
{
path: 'tab1',
children: [
{
path: '',
loadChildren: '../tab1/tab1.module#Tab1PageModule'
}
]
},
{
path: 'tab2',
children: [
{
path: '',
loadChildren: '../tab2/tab2.module#Tab2PageModule'
}
]
},
{
path: 'tab3',
children: [
{
path: '',
loadChildren: '../tab3/tab3.module#Tab3PageModule'
}
]
},
{
path: '',
redirectTo: '/tab1',
pathMatch: 'full'
}
]
}
];
```
**Other information:**
To make it simple - While on `/tab1`, clicking on the second tab leads me to `/tab1/tab2` instead of `/tab2`

**Ionic info:**

```
Ionic:

ionic (Ionic CLI) : 4.3.1 (C:\Users\YDrogen\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.0.0-rc.0
@angular-devkit/build-angular : 0.11.4
@angular-devkit/schematics : 7.1.4
@angular/cli : 7.1.4
@ionic/angular-toolkit : 1.2.2

System:

NodeJS : v8.9.1 (C:\Program Files\nodejs\node.exe)
npm : 5.6.0
OS : Windows 10
```

贡献指南

打开贡献指南

调研方向

Start with the generated tabs.router.module.ts from the reproduction steps and inspect how ion-tab-button navigation behaves when the parent path is empty. Reproduce the issue by navigating between /tab1 and /tab2, then verify that each tab reaches its intended root URL rather than a nested path.

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。