Reputation: 19
I am simply trying to take the user input from the input element and save it in a variable.
This is what my component typescript looks like:
export class MyComponent {
userInput: string = '';
}
This is what my html looks like:
<input name="userInput" [(ngModel)]="userInput">
And this is what my app.module.ts looks like:
@NgModule({
declarations: [
AppComponent,
MyComponent
],
imports: [
FormsModule
],
bootstrap: [AppComponent]
})
export class AppModule { }
I am getting this error:
ERROR TypeError: Cannot read properties of null (reading '_rawValidators')
I've searched all over but can't find anything for this particular error. Does anyone have any ideas?
Upvotes: 0
Views: 357
Reputation: 19
I found out my particular issue involved my input element being inside a different form element by accident. Moving the input element outside of the form element fixed this issue.
Upvotes: 1