Reputation: 1
Can't bind to 'ngClass' since it isn't a known property of 'input'.
I have migrated the angular project from version 8 to 9 and facing this type of errors.
src/app/components/header/header.component.ts:28:16
28 templateUrl: './header.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component HeaderComponent.
src/app/components/header/header.component.html:72:109 - error NG8002: Can't bind to 'ngClass' since it isn't a known property of 'input'.
72 <input type="text" name="username" class="form-control" [(ngModel)]="user.username" [ngClass]="{'is-invalid': userName.errors && userName.touched}" #userName="ngModel" class="form-control user-icon" name="userName" required minlength="2" maxlength="30"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/components/header/header.component.ts:28:16
28 templateUrl: './header.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component HeaderComponent.
src/app/components/header/header.component.html:83:79 - error NG8002: Can't bind to 'ngModel' since it isn't a known property of 'input'.
Even I have imported the CommonModule and FormsModule and added them to the imports array in app.module.ts. I have declared all components in app.module.ts
Thank you for your help.
Upvotes: 0
Views: 57