Click on an <img> to display a <ion-select> like


#1

Hi,

I have a header which contain a title and an image (which representate the selected language).
I want to be able to click on the image : <img *ngIf="imgLang" (click)="ChangeLang()" style="float: right; padding-right: 10px;" height="26px" [src]="imgLang"/> and be able to make the ChangeLang() method to display an with some option like : French, English… etc.

I can’t see a select controller in the Ionic API but I saw something which use the ActionSheetController but I didn’t get a word of it

Anyone could help please?


#2

resolved by doing this instead:

  ChangeLang(){
    let alert = this.alertCtrl.create();
    alert.setTitle('Select language');

    let fr = {
      type: 'radio',
      label: 'French',
      value: 'fr',
      checked: false
    }, en = {
      type: 'radio',
      label: 'English',
      value: 'en',
      checked: false
    };
    if (this.lang == "fr"){
      fr.checked = true;
    } else {
      en.checked = true;
    }
    alert.addInput(fr);

    alert.addInput(en);

    alert.addButton('Cancel');
    alert.addButton({
      text: 'Change',
      handler: (data: any) => {
        this.ChangeImageLang(data)
      }
    });

    alert.present();