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.

bug: ion-router does not work with query params

See original GitHub issue

Bug Report

Ionic version: 4.9.1

Current behavior: I use ion-router component in stencilJs.

Here is ion-router config:

<ion-router useHash={false}>
    <ion-route url="/home" component="app-home-page" />
</ion-router>

I need to open /home page with query params (/home?p=1)

Navigation to /home?p=1 does not work. I tried to navigate using ion-router-link component: <ion-router-link href={"/home?p=1"}>Home page</a> and using ion-router component

const nav = document.querySelector('ion-router');
nav.push("/home?p=1")

In both cases there is an error console: route not found. But if I reload the page in browser then page is successfully opened.

Expected behavior:

Navigation to /home?p=1 must work.

Steps to reproduce:

  1. In stencilJs add ion-router:
<ion-router useHash={false}>
    <ion-route url="/home" component="app-home-page" />
</ion-router>
  1. try to navigate to “/home?p=1”

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
mslourenscommented, Jun 9, 2020

@tricki the issue has been solved in 5.1.1. I just tested it, the querystring gets passed along with the route.

0reactions
ionitron-bot[bot]commented, Jul 25, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: ion-router does not work with query params · Issue #19707
Bug Report Ionic version: 4.9.1 Current behavior: I use ion-router component in stencilJs. Here is ion-router config: I need to open /home ...
Read more >
ionic4 Angular 7 query params subscribe is not triggering on ...
I'm trying to subscribe the query params. But it is not 'console' the changes when ever there is a change. It works in...
Read more >
How to Pass Data with Angular Router in Ionic [v4]
Now we can get into the three different solutions we got for our problem. 1. Using Query Params (bad). The first option is...
Read more >
ionic/www/29-es2015.js.map ... - GitLab
n *\n * Accepts paths similar to expressjs so that you can define parameters\n * in the url /foo/:bar where bar would be...
Read more >
angular - Ionic menu unable to open after navigate to the same page ...
seems like ionic-router-outlet bug (btw about year ago had similar problem with ion-nav, when it makes component with display: none instead deleting it...
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