Angular error input field

I am working on an Angular application and try to acces a value of an input field. I receive following error: "Can't bind to 'ngModel' since it isn't a known property of 'input'" Can anybody help me out?
2 answers

You should also additionally to the FormsModule import the ReactiveFormsModule from Angular.

import { FormsModule, ReactiveFormsModule } from '@angular/forms';

@NgModule({
imports: [
[...]
FormsModule,
ReactiveFormsModule
],
[...]
})

The problem you receive is becaus you did not import the Formsmodule into your module and because of this ngModel is not recognized as a property of input.
Add following import to your module:

@NgModule({
imports: [
[...]
FormsModule
],
[...]
})

Comments

You should also additionally to the FormsModule import the ReactiveFormsModule from Angular.

import { FormsModule, ReactiveFormsModule } from '@angular/forms';

@NgModule({
imports: [
[...]
FormsModule,
ReactiveFormsModule
],
[...]
})

Markus Hegedüs - Mon, 12/14/2020 - 16:15 :::