How get selected value from dropdown menu

This is my Html code here.

<ion-item>
      <ion-label>Month</ion-label>
      <ion-select [(ngModel)]="filtermonthwise" interface="action-sheet" (ionChange)="monthfilter(filtermonthwise);">
        <ion-option value="1">January</ion-option>
        <ion-option value="2">February</ion-option>
        <ion-option value="3">March</ion-option>
        <ion-option value="4">April</ion-option>
        <ion-option value="5">May</ion-option>
        <ion-option value="6">June</ion-option>
        <ion-option value="7">July</ion-option>
        <ion-option value="8">August </ion-option>
        <ion-option value="9">September</ion-option>
        <ion-option value="10">October </ion-option>
        <ion-option value="11">November </ion-option>
        <ion-option value="12">December </ion-option>

      </ion-select>
    </ion-item>

Below my ts file function;

monthfilter(filtermonthwise){
console.log(filtermonthwise) ;//show nothing 
}

filtermonthwise value is not showing how can i fix that

add a class variable

export class TesttPage {
filtermonthwise: any;  //<- equals [(ngModel)]="filtermonthwise" in html;

then

monthfilter() {

    console.log(this.filtermonthwise);

  }

actually i want to filter value month wish how can i do that?

I’m so confused, I click on April and it returns 4, humm the 4th month of the year is april ???

yes.4th month of the year is april

1 Like