How to set global variable for all function

I have a problem where the variable I use doesn’t apply to all functions,
when I put a variable in one function I can’t take the value in the other function

thismy.ts


export class BooktravelPage {
  public kursi_dipilih:any;
  public jumlah_kursi_dipilih: any;
  public kursis_dipilih: any;
  public list_kursi_dipesan:any;
  public kursi:any;

  constructor(public navCtrl: NavController, public navParams: NavParams, private storage: Storage, public authService: AuthServiceProvider) {
  }

  ionViewWillEnter(){
    this.kursi_dipilih;
    this.jumlah_kursi_dipilih = 0;
    this.kursis_dipilih = new Array();
    this.list_kursi_dipesan;
    //$scope.jumlah_kursi_dipilih	= 0;
    this.kursis_dipilih.length = 0;
    this.kursi = '';
}

pilihKursi(){
    this.storage.get('blalala_m').then((prof) => {

      this.datauser = JSON.parse(prof);
      this.id =  this.datauser[0].id;
    this.authService.getAll('getLayoutTravel', this.travel.id_produk,this.travel.layout_kursi,this.travel.kode.replace(/-/g, "_"),this.travel.tanggal.replace(/-/g, "_")).then((result) => {
      this.data = result;
      this.layout = this.data.seat2;
      //console.log(this.layout);
      
      Array.prototype.forEach.call(this.layout, function(value,key) {
        Array.prototype.forEach.call(value.col, function(value2,key2) {
        //console.log(value);
        //console.log(JSON.stringify(key));
        //console.log(JSON.stringify(value2));

        if(value2.no == no_kursi){
          //console.log(this.jumlah_kursi_dipilih);
          console.log(jum_pnp);
          if(value2.tampil == false){
            this.layout.seat2[key].col[key2].tampil = true;
            this.kursis_dipilih[no_kursi] = '';
            this.jumlah_kursi_dipilih--;
          }else if(this.jumlah_kursi_dipilih<jum_pnp){
            console.log(this.jumlah_kursi_dipilih);
            this.layout.seat2[key].col[key2].tampil = false;
            this.jumlah_kursi_dipilih++;
            this.kursis_dipilih[no_kursi] = '1';
          }
        }
        //console.log(key + ': ' + value);
    });
    });

    this.list_kursi_dipesan	= '';
		var i;
		for(i=1;i<=this.kursis_dipilih.length;i++){
		  this.list_kursi_dipesan += this.kursis_dipilih[i]=='1'?i+',':'';
		}
    this.kursi = this.jumlah_kursi_dipilih>0?this.list_kursi_dipesan.substring(0,this.list_kursi_dipesan.length-1):'silahkan pilih kursi yang anda inginkan';
    
    }).then(function(){

    });
  });
}

Any controller property that is accessed by a template must be given a sane initial value either at the point of declaration (vastly preferred if possible) or in the constructor. ionViewWillEnter is unacceptably late for doing this.

I put the variable in the constructor also the same, the value that comes out undefined

I don’t believe you.