question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NavController.goForward() query params don't work

See original GitHub issue

Bug Report

Ionic Info

Ionic:

   ionic (Ionic CLI)          : 4.1.0
   Ionic Framework            : @ionic/angular 4.0.0-beta.2
   @angular-devkit/core       : 0.7.3
   @angular-devkit/schematics : 0.7.3
   @angular/cli               : 6.1.3
   @ionic/ng-toolkit          : 1.0.6
   @ionic/schematics-angular  : 1.0.5

System:

   NodeJS : v8.11.3
   npm    : 5.6.0
   OS     : Windows 10

Describe the Bug Query params passed via NavController.goForward() are not appended to the URL.

Steps to Reproduce

  1. Create starter app: ionic start myApp sidemenu --type=angular
  2. Add button to side menu (or anywhere), wire to following handler:
test(): void {
      this.navController.goForward(`/list`, true, { queryParams: { dummy: 4 }});
  }

Expected Behavior When clicking button, browser should navigate to “/list?dummy=4”. Instead it navigates to “/list” without query param.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
MichaelMalonycommented, Aug 20, 2018

Sure, but then you lose the forward/back/root hints that Ionic (maybe) uses. Really I just want a clear answer from Ionic team on which we should be using going forward in an Ionic project.

4reactions
kirliamcommented, Oct 10, 2018

Hello, I am using beta.12, and it works only if I use the URL as array:

this.router.navigate( [‘/list’] , { queryParams: { dummy: 4 }}); } WORKS this.router.navigate( ‘/list’ , { queryParams: { dummy: 4 }}); } NO QUERY PARAMS

Read more comments on GitHub >

github_iconTop Results From Across the Web

NavController.goForward() Query Params - Ionic Framework
Attempting to pass query params via nav controller doesn't seem to work. Here is a simplified version of what I have. this.navController.
Read more >
NavController.goForward() query params don't work #15219
Query params passed via NavController.goForward() are not appended to the URL. ... When clicking button, browser should navigate to "/list?dummy=4 ...
Read more >
Ionic 4 - how to pass data between pages using navCtrl or ...
I have solved this by wrapping the Ionic NavController in a provider which has functions to set a value to a variable ...
Read more >
Navigate to a destination - Android Developers
Navigating to a destination is done using a NavController , an object that manages app navigation within a NavHost .
Read more >
Navigating in Jetpack Compose - Medium
To navigate when a button in our FeedScreen is clicked we added the NavController to the FeedScreen 's parameters. Finally, when the button...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found