Ng model not working. (app.component.html - ionic v5)

ng model not working in app.component.html file. What should I do?

Thanks in advance.

  <!-- Category Edit Form-->
          <ion-card class="ion-padding" *ngIf="EditForm">
            <ion-label position="stacked"> <strong>Edit Category</strong></ion-label>      
            <ion-input type="text" [(ngModel)]="UpdateCategory"> </ion-input>
              <ion-icon  class="ion-float-right"  name="checkmark-outline" size="large"  slot="icon-only"  color="primary"></ion-icon>
              <ion-icon  class="ion-float-left" (click)="closeForm()" name="close-outline"  size="large" slot="icon-only"  color="danger"></ion-icon>      

Error Message

Can’t bind to ‘ngModel’ since it isn’t a known property of ‘ion-input’.

  1. If ‘ion-input’ is an Angular component and it has ‘ngModel’ input, then verify that it is part of this module.

  2. If ‘ion-input’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message.

  3. To allow any property add ‘NO_ERRORS_SCHEMA’ to the ‘@NgModule.schemas’ of this

Stop posting images as text and import FormsModule.

1 Like

Thank you very much for your reply.

Can you sample the use of the Forms Module or suggest a resource?

I have the same issue. Have you find a solution ?

I did this:
import { FormsModule } from ‘@angular/forms’


imports: [ … , FormsModule ],


but not work for me, perhaps, I am in my component.

I used (ionChange) and (ionInput) in ionic 4, but it does not work now, the event haven’t the value because I can’t cast it to TextInput, this type doesn’t exist anymore

<ion-input [value]=“myData” (ionChange=“onChange($event,data)”>