Ionic 3 navParams.get broken 50% of the time

171 Views Asked by At

I have code in my app-component.ts

import {Nav} from 'ionic-angular';

...
@ViewChild(Nav) nav: Nav;
...
this.nav.setRoot(page.component, params)
  .catch((err: any) => {
       console.log(`Didn't set nav root: ${err}`);
});

Then in two separate pages:

let data = this.navParams.get('data');
console.log(data);
this.job = data;
  1. Page 1 (a modal), it works fine
  2. Page 2 (not a modal) data is undefined.

So I doing this instead to fix:

let data = this.navParams.data

and it works.

Here's a crazy debug screenshot to showcase how get is broken 'sometimes'!

Anyone else experienced this. Is there some glaring mistake I'm overlooking?

enter image description here

0

There are 0 best solutions below