Assign value in ActionSheetCtrl handler


#1

Hello,
i have this small problem, i wanna to assign a value to a specific variable in a handler function.

actionSheetTakePicture(){
    let cameraOptions;
    let actionSheet = this.actionSheetCtrl.create({
      title: 'Select image source',
      buttons: [
        {
          text: 'Use Camera',
          icon: 'camera',
          handler: () => {
            cameraOptions = this.camera.PictureSourceType.CAMERA;
          }
        },{
          text: 'From Gallery',
          icon: 'images',
          handler: () => {
            cameraOptions = this.camera.PictureSourceType.PHOTOLIBRARY;
          }
        },{
          text: 'Cancel',
          icon: 'close',
          role: 'cancel',
          handler: () => {
            console.log('Cancel clicked');
          }
        }
      ]
    });
    actionSheet.present();
    console.log(cameraOptions);
    return this.takePicture(cameraOptions);
  }

the cameraOption must take the value, but it doesn’t work