Search code examples
angulartypescriptionic2ionic3

Checkbox Alert Controller - Show image


I make one application with IONIC-2 Beta version. i 'm use Checkbox Alert Controller, and want to add image like,

this

my code is

showCheckbox() {
let alert = this.alertCtrl.create();
alert.setTitle('Which planets have you visited?');

alert.addInput({
  type: 'checkbox',
  label: 'Alderaan',
  value: 'value1',
  checked: true
});

alert.addInput({
  type: 'checkbox',
  label: 'Bespin',
  value: 'value2'
});

alert.addButton('Cancel');
alert.addButton({
  text: 'Okay',
  handler: data => {
    console.log('Checkbox data:', data);
    this.testCheckboxOpen = false;
    this.testCheckboxResult = data;
  }
});
alert.present();

}

is it possible to add image like this??

If anyone knows the solution, please help me.

Thanks.


Solution

  • I'm afraid that's not possible with the AlertController. You could use the ModalController (info) to present a custom page and in that page you could use a Grid to create that layout, but in terms of look and feel the result will be slightly different.