Reputation: 1302
I have this Ionic
version 4 code that is simply trying to take a the selected value and pass it to a function in it's component:
<ion-item>
<ion-label>Convert Currency</ion-label>
<ion-select [(ngModel)]="currency">
<ion-select-option *ngFor="let c of currencyData" [value] = "c" >{{c.text}}</ion-select-option>
</ion-select>
I tried onChange
but that is apparently not in version 4.
Upvotes: 4
Views: 13875
Reputation: 151
you can use ionChange to pass the selected value as follow :
<ion-select (ionChange)="checkValue($event)" interface="popover"
placeholder="Select One" >
<ion-select-option *ngFor="let c of currencyData" [value]="c">
{{c.text}}</ion-select-option>
</ion-select>
In your typeScript:
checkValue(event){ console.log(event.detail.value)}
Upvotes: 8
Reputation: 222582
You are looking for ionChange
<ion-select [(ngModel)]="currency" (ionChange)="yourFunction($event)">
Upvotes: 9