Ionic 7 Modal - Multiple form input values?

Is there a way to get multiple input fields from a form inside a modal? My use case captures first name, last name, and email of someone user would like to invite to. The html for the form inside the modal is:

   <ion-list  class="ion-margin ion-padding ion-text-center">
   <ion-item  class="ion-margin-vertical">
   <ion-input label="First Name" autocomplete="off" name="firstname" type="text" [(ngModel)]="postData.firstname"></ion-input>

 <ion-item class="ion-margin-vertical">
 <ion-input label="Last Name" autocomplete="off" name="lastname" type="text" [(ngModel)]="postData.lastname"></ion-input>

 <ion-item  class="ion-margin-vertical">
<ion-input label="Email" autocomplete="off" name="email" type="email" [(ngModel)]=""></ion-input>

    <ion-button size="medium" shape="round" color="primary" (click)="confirm()" class="buttonDesign"><strong>Invite</strong></ion-button>


In my modal ts file -

   postData = {
         firstname: '',
         lastname: '',
         email: '',
      constructor(private modalCtrl: ModalController) { }

      ngOnInit() {}

      cancel() {
        return this.modalCtrl.dismiss(null, 'cancel');

      confirm() {
        this.modalCtrl.dismiss(this.postData, 'confirm');

But every time, I confirm - this.postData returns an empty array. I can successfully do it for a single input field from a modal.

Resolved it myself. Had to declare it in my pagename.module.ts file.