ionic-team / ionic-team/ionic-framework
bug: ionic angular does not fully support relative and auxiliary routes
- Lingua principale
- TypeScript
- Stelle
- 52.7k
- Fork
- 13.3k
- Merge medio
- 1g 15h
- PR unite (30g)
- 51
Descrizione
# Bug Report
**Ionic version:**
[x] **4.x**
**Current behavior:**
routerLink stops working after navigating to and subsequently deactivating a named/secondary outlet route.
**Expected behavior:**
Router Links should continue to work even after the outlet/route they refer to has been navigated to and subsequently deactivated.
**Steps to reproduce:**
0. Clone sample app, cd into folder, npm i, ionic serve...
1. Open the application http://localhost:8100
2. Click "Metagame" on the app menu
3. Click "Works once"
4. Click the (X) at the top of the detail outlet to close it (or click "Metagame in the menu again)
5. Click "Works once" --- *Nothing happens* --- we should re-open the detail/secondary outlet here but it does not.
6. Click "Works every time" -- the outlet opens like it should have. But we should not need to specify fully qualified URLs to routerLink, that's horrifyingly leaky and a maintenance nightmare
Now. In app.component.html, replace `` with ``
Repeat steps 1-5: The outlet opens as expected.
This is a blocking bug in ion-router-outlet. The only workaround is to hardcode fully qualified router URLs in the entire application, rather than properly targeting named router outlets directly via their proper relative URL. which would immediately break everything as soon as a single route in the middle of the hierarchy is changed.
**Related code:**
https://github.com/TopDecked/ionic-router-outlet-bug
**Other information:**
This seems related to:
https://github.com/ionic-team/ionic/issues/16534
https://github.com/ionic-team/ionic/issues/18197
https://github.com/ionic-team/ionic/issues/18823
https://github.com/ionic-team/ionic-v3/issues/713 (this should not have been moved to v3 repo...)
**Ionic info:**
```
Lincolns-MacBook-Pro-2:topdecked-named-router-bug lincoln$ ionic info
Ionic:
Ionic CLI : 5.2.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.6.2
@angular-devkit/build-angular : 0.800.3
@angular-devkit/schematics : 7.3.1
@angular/cli : 8.0.3
@ionic/angular-toolkit : 1.5.1
Cordova:
Cordova CLI : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : not available
Cordova Plugins : not available
Utility:
cordova-res : not installed
native-run : 0.2.7 (update available: 0.2.8)
System:
Android SDK Tools : 26.1.1 (/usr/local/share/android-sdk)
ios-deploy : 1.9.4
NodeJS : v12.3.1 (/usr/local/Cellar/node/12.3.1/bin/node)
npm : 6.10.1
OS : macOS Mojave
Xcode : Xcode 10.2.1 Build version 10E1001
```
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.