2022-02-24

ngModel does not work on modal page in Ionic 6

I am developing an Ionic/Angular app and wanted to use ngModel as alwayls. I am opening a modal from a modal and then want to use it like:

<ion-list>
<ion-item>
  <ion-label position="stacked">Name des Rezepts</ion-label>
  <ion-input [(ngModel)]="model" ></ion-input>
</ion-item>
</ion-list>
<ion-button (click)="save()">Save</ion-button>

i declared the variable in typescript like:

public model="";

But when i click save, my output IS ALWAYS the empty string?!

I imported ReactiveFormsModule in my app.module.ts and on normal pages it works, but in modals it seems like that it does not work?!

Do you guys have any ideas? Thank you!



No comments:

Post a Comment