Why the error 'Uncaught (in promise): TypeError: co.data is undefined View_BirthCertificatePage_0'?

Dear Friends,
I am working for a simple form with one filed to a page. My html sample code is:

<!--
  Generated template for the PaymentPage page.

  See http://ionicframework.com/docs/components/#navigation for more info on
  Ionic pages and navigation.
-->
<ion-header>
  <ion-navbar>
  <ion-title>
  Ionic3 Server Send Test
  </ion-title>
  </ion-navbar>
 </ion-header>

 <ion-content padding>
  <ion-list>
  <ion-item>
  <ion-label floating>Username</ion-label>
  <ion-input type="text" name="username" [(ngModel)]="data.username"></ion-input>
  </ion-item>

  <button ion-button block (click)="submit()">Submit to server</button>
  </ion-list>

  <ion-card>
  <ion-card-header>
  Response
  </ion-card-header>

  <ion-card-content>
  <b>fsd</b>
  </ion-card-content>
  </ion-card>
 </ion-content>

My error message is:

Uncaught (in promise): TypeError: co.data is undefined
View_BirthCertificatePage_0/<@ng:///AppModule/BirthCertificatePage.ngfactory.js:406:9
debugUpdateDirectives@http://localhost

Waiting fast reply

Thanks

Anes

Ionic doesn’t accept ngModel

Problem is fixed … :star_struck:

Post here how you fix it, please. Maybe someone needs it

is it truth ? In ionic 2 i think some says it work. You tell the case of ionic 3 ?

Looks like ngModel really works, I was wrong, sorry about it. I just don’t understand how it works with ngModel, because all the times I tried with it didn’t work.

Yes guilper, it will work with as shown in a username text field below

<ion-input type=“text” formControlName=“username” [(ngModel)]=“data.username”>

Thanks

Anes