android - Get 2 selected value and pass to button for display -


what's best way me both selected value 2 selection list , display image array once user hit button? possible?

<ion-list>   <ion-item>    <ion-label>gaming</ion-label>     <ion-select [(ngmodel)]="gaming1" (ionchange)='valuechange(gaming1)'>       <ion-option *ngfor="let item of alllist" [value]="item.values">{{item.name}}</ion-option>      </ion-select>   </ion-item>   <ion-item>     <ion-label>gaming</ion-label>      <ion-select [(ngmodel)]="gaming2">        <ng-container *ngfor="let item of alllist">          <ion-option [value]="item.values" *ngif="item.flag==0">{{item.name}}</ion-option>         </ng-container>     </ion-select>   </ion-item> </ion-list>  <button ion-button block (click)="getdata(gaming1 + gaming2)">pass data</button> 

component .ts file, tested function button working dont know how show image html file:

public alllist: any;       public endplaces: any;        constructor(public navctrl: navcontroller){          this.alllist=[{           name:'nes',           values:'nes',           flag:0         },{           name:'nintendo64',           values:'n64',           flag:0         },{           name:'playstation',           values:'ps',           flag:0         }];          this.endplaces=[{           name:'dota',           values:'nesn64',           image:'assests/img/dotajpg'         },{           name:'csgo',           values:'nesps',           image:'assets/img/csgo.jpg'         },{           name:'overwatch',           values:'nes',           image:'assets/img/overwatch.jpg'         }]        }        valuechange(key){            for(let = 0 ; < this.alllist.length ; i++){             if( this.alllist[i].values==key){               this.alllist[i].flag=1;             }else{               this.alllist[i].flag=0;             }           }        }        getdata(selectedvalue){          for(let = 0 ; < this.endplaces.length ; i++){         if( this.endplaces[i].values==selectedvalue){           console.log("selected", this.endplaces[i].name);         }else{           console.log("dangggg");         }       }       }     } 

update:console log

thank in advanced

you should pass parameters comma separated controller like:

    <!--in html file-->         <img src="{{matchendplace.image}}">         <button ion-button block (click)="getdata(gaming1, gaming2)">pass data</button>   //in ts file matchendplace: = {}; getdata(gaming1, gaming2){    let matchstring = gaming1.tolowercase() + gaming2.tolowercase();    this.matchendplace = this.endplaces.find(e => e.values === matchstring) || {}; }  this.endplaces=[{           name:'dota',           values:'nesn64',           image:'./assests/img/dotajpg'         },{           name:'csgo',           values:'nesps',           image:'./assets/img/csgo.jpg'         },{           name:'overwatch',           values:'nes',           image:'./assets/img/overwatch.jpg'         }] 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -