Ion-select does not work as it should

0

I have the following code for ion-select:

<ion-item class="drop-categoria" style="margin-bottom: 5%; ">
  <ion-label>Categorias</ion-label>
  <ion-select [(ngModel)]="catselected" (ng-change)="onChange(catselected)">
    <ion-option *ngFor="let cat of categorias" [value]="cat.nome" >{{ cat.nome }}</ion-option>
  </ion-select>
</ion-item>

And no .ts:

  onChange(catselected){
    console.log(catselected);

    }

I need to get the selected value, in this case the cat.nome , but when I click OK, nothing happens, no error, and no response, what can it be?     

asked by anonymous 22.07.2018 / 01:39

1 answer

0

Min worked as follows:

<ion-item class="drop-categoria" style="margin-bottom: 5%; ">
  <ion-label>Categorias</ion-label>
  <ion-select [(ngModel)]="cati" (ionChange)="onChange(cati);">
    <ion-option *ngFor="let cat of categorias" [value]="cat.nome" >{{ cat.nome }}</ion-option>
  </ion-select>
</ion-item>

and no .ts

  onChange(){
    console.log(this.cati);

    }
    
22.07.2018 / 02:17