Create public variable and use it as Button-caption


I am looking for a way to create a variable that I can access from a different pages. I want to create it at one page and use it as button-caption on another page.

This is the first page. In this .ts I want to create the variable:

export class SettingsPage {

  constructor(public navCtrl: NavController, public navParams: NavParams) {}
		var goal:number = 5;


And this is the second page where I want to use it as label (.html):

<button ion-button large >variable {{goal}}</button>

If you have any suggestions how to do this, in the best case with some code, I would be very thankfully.



I think you would really benefit from going through the Tour of Heroes. It would have answered your last couple of questions, it will answer this one, and it will answer the next ten or so as well.