NavParams always undefined


#1

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?


#2

Try not quoting the parameter names in the nav.push


#3

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


#4

@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.


#5

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


#6

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

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


#7

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