NavParams always undefined

I am trying to pass some parameters as below:

    this.nav.push(TextoPage, {
        'titulo': 'XXXXX',
        'texto': this.appInfo.quemsomos
    });
  }

And my NavParams is always returning undefined.

import {Page, NavController, NavParams} from 'ionic-angular';

@Page({
  templateUrl: 'build/pages/texto/texto.html',
})
export class TextoPage {
  static get parameters() {
    return [[NavController, NavParams]];
  }

  constructor(nav, navParams) {
    this.nav = nav;
    this.navParams = navParams;
   
  
    this.titulo = this.navParams.get("titulo");
    this.texto  = this.navParams.get("texto");
  }
}

What am i missing?

1 Like

Try not quoting the parameter names in the nav.push

I think you should be doing navParam.data to get the parameter data. Example

@grysoft make sure you’re passing in info to the method that calls nav.push

From the looks of things, the way you’re trying to get the params looks fine, so the issue is probably coming from the first view where you’re setting them.

@richardshergold Not necessarily the case for this issue. While that grabs the whole navParma object, what grysoft its trying is still valid

Got it. The problem was in my parameters function, that should be:

static get parameters() {
return [[NavController], [NavParams]];
}

2 Likes

thanks @grysoft exactly working. For this issue have worked around 4 hours…

1 Like