Hey guys so im trying to learn angular, and i am trying to build a simple crud project. I am trying to build a form to add user data but i keep getting the following error in one of my html files
(directive) FormGroupDirective
Can't bind to 'formGroup' since it isn't a known property of 'form'.ngtsc(-998002)
user-add-edit.component.ts(4, 21): Error occurs in the template of component UserAddEditComponent.
The required module ReactiveFormsModule is already imported in the app module file alongside other imports requried.
Also everything in my components script seems to be ok.
Anyone have any ideas on what the issue might be
<form [formGroup]="userForm" (ngSubmit)="onFormSubmit">
The component:
import { Component } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
@Component({
selector: 'app-user-add-edit',
templateUrl: './user-add-edit.component.html',
styleUrls: ['./user-add-edit.component.css']
})
export class UserAddEditComponent {
userForm : FormGroup;
constructor( private _fb:FormBuilder){
this.userForm = this._fb.group({
firstName: '',
lastName: '',
phone: '',
email: '',
});
}
onFormSubmit(){
if(this.userForm.valid){
console.log(this.userForm.value);
}
}
}
`