Help with importing results


#1

Hello! im kinda new to the ionic plataform. The only experience with programming i have is software dev with C# so this is kinda new to me.I have an very basic app where i count the taps on 2 buttons and i need the result to show up in another page. I have the code for the taps but I’m having problems importing the results.

 public tapEvent(e)
  {
  
    this.tap++;
    
  }
  public TapEventBotaoUm(e)
  {
    if(this.tap ==10)
    {
      this.navCtrl.push(ContactPage)
    }
    else
    {
    this.tap++;
    this.tapBotaoUm++;
    }
  }

  public TapEventBotaoDois(e)
  {
    if(this.tap ==10)
    {
      this.navCtrl.push(ContactPage)
    }
    else
    {
    this.tap++;
    this.tapBotaoDois++;
    }

i need to show in ContactPage the result of taps on each button.Thank you :smiley:


#2

The NavController.push function accepts a second argument, namely data that you can push to the page.

So you can do:
this.navCtrl.push(ContactPage, { tap: this.tap, tapBotaoDois: this.tapBotaoDois });

Then in Contact page you can do:
navParams.get("tap");
And
navParams.get("tapBotaoDois");


#3

Thank you for helping me. I did what you said and worked the way o wanted…Thanks ;D