Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend NavController to support Angular's router.navigate calls (rather than just router.navigateByUrl) #15332

Closed
ChrisPearce opened this issue Aug 26, 2018 · 2 comments
Assignees

Comments

@ChrisPearce
Copy link

ChrisPearce commented Aug 26, 2018

Feature Request

Ionic Info
Run ionic info from a terminal/cmd prompt and paste the output below.

Ionic:

   ionic (Ionic CLI)          : 4.1.1 (/Users/chris/.npm-global/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.3
   @angular-devkit/core       : 0.7.5
   @angular-devkit/schematics : 0.7.5
   @angular/cli               : 6.1.5
   @ionic/ng-toolkit          : 1.0.7
   @ionic/schematics-angular  : 1.0.5

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.0.3, (and 3other plugins)

System:

   NodeJS : v10.9.0 (/usr/local/bin/node)
   npm    : 6.2.0
   OS     : macOS
   Xcode  : Xcode 10.0 Build version 10L232m

Describe the Feature Request

Extend the navigateForward and navigateBack functionality of the NavController to support both Angular's router.navigateByUrl and Angular's router.navigate.

Currently, navigateForward and navigateBack call Angular's router.navigateByUrl.

The difficult posed by this is that Angular's router.navigateByUrl does not implement some of the NavigationExtras such as { queryParams: { foo: fooValue } }.
See angular/angular#22611

Describe Preferred Solution
It would be very helpful to extend the navController to have 4 methods:

  • navigateForward - that uses Angular's router.navigate call
  • navigateForwardByUrl - that uses Angular's router.navigateByUrl call
  • navigateBack - that uses Angular's router.navigate call
  • navigateBackByUrl - that uses Angular's router.navigateByUrl call

This would allow developers to use all the functionality provided by Angular's router navigation functionality.

Currently, developers can't use the Ionic Nav Controller methods if they want to use common application features such as query params.

Describe Alternatives

Workaround is to use Angular's router.navigate call directly but then developers don't get the animation benefits of the Ionic NavController.

Related Code
None

Additional Context
angular/angular#22611

@ionitron-bot ionitron-bot bot added triage and removed triage labels Aug 26, 2018
@manucorporat manucorporat self-assigned this Aug 26, 2018
@ptitjes
Copy link
Contributor

ptitjes commented Aug 27, 2018

@manucorporat, in 7aa4f13, you forgot to add | any[] to the signature of the first parameter of the methods navigateBack() and navigateRoot(). You only did it on navigateForward().

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 26, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants