i cannot import FormsModule in task.component.ts file under task folder .Due to unable to solve error as "Can't bind to 'ngModel' since it isn't a known property of 'input'.ngtsc(-998002)" .My code is <input type="text" class="form-control" [(ngModel)]="newTask.description"> in task.component.html file.Pls help to resolve this error.
If task component is standalone, add FormsModule
to the imports array.
@Component({
standalone: true,
imports: [
...
FormsModule,
...
],
...
})
export class TaskComponent {
...
If the task is not standalone, go to the place where you delared the component declarations
array. Then import FormModule
.
@NgModule({
...
imports: [
...
FormsModule,
...
]
...
})
export class SomeModule {}