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.

Multiple values of NavParams does not work with dynamic links

See original GitHub issue

Ionic version: (check one with “x”) [ ] 1.x [ ] 2.x [x] 3.x

I’m submitting a … (check one with “x”) [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

If i use dynamic link in deep link support,

@IonicPage({
  name: 'detail-page',
  segment: 'detail/:id'
})

when i put 2 values id and name in param value

 pushPage(detailInfo) {
    // Push an `id` to the `'detail-page'`
    this.navCtrl.push('detail-page', {
      'id': detailInfo.id,
      'name': 'Example'
    })
  }

then i can only get id value, but value of name is undefined

export class MyPage{
 constructor(public params: NavParams){
   this.params.get('id');
   this.params.get('name'); // name is undefined
 }
}

Expected behavior:

It should return value for name attribute.

export class MyPage{
 constructor(public params: NavParams){
   this.params.get('id');
   this.params.get('name'); // name is should be `Example`
 }
}

Steps to reproduce:

Related code:

insert any relevant code here

Other information:

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

insert the output from ionic info here

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
Alfred-Lucommented, May 17, 2017

If the name param is in segment like ‘detail/:id/:name’, then url ‘/#/detail/12’ won’t work to get the right detail page.

How can ‘name’ be an optional param? Like @patrickmcd mentioned? @jgw96

1reaction
ipehimanshucommented, Jan 23, 2018

Hello

is there any way to refresh current page (Ctrl +F5 or copy url and open url in new tab) with all params in ionic 3 ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple values of NavParams does not work with dynamic links
Expected behavior: It should return value for name attribute. export class MyPage{ constructor(public params: NavParams){ this.params.get('id'); ...
Read more >
how to add a dynamic button using navparams in ionic 2
I am building an app in Ionic 2, I am using navparams tu grab the button pressed when pushing another page. In this...
Read more >
Ionic 4 Tab to page then back to Tab did not trigger ...
I have an small application where user can edit their account and after edit user route back to my account page. Situation: My...
Read more >
Pass data between destinations - Android Developers
Destination-level arguments and default values are used by all actions that navigate to the destination. If needed, you can override the default ...
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 >

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