I am working on a project where I want to display a form inside a bootstrap modal. I have added the bootstrap modal as available on their website and trying to add a reactive form in its body. Below is my code:
.html
...
<div class="modal-body">
<form [formGroup] = "addDataForm">
<div class="form-group">
<label>Project Type</label>
<input type = "text" class="form-control" [formControlName] = "pt">
<label>Fiscal Year (F.Y.)</label>
<input type="text" class = "form-control" [formControlName] = "fiyr">
<label>Task Description</label>
<input type="text" class="form-control" [formControlName] = "td">
</div>
</form>
</div>
...
.ts
addDataForm: FormGroup;
ngOnInit()
{
this.addDataForm = new FormGroup({
'pt': new FormControl(null),
'fiyr': new FormControl(null),
'td': new FormControl(null),
});
I have also imported both of these modules in:
app.module.ts
import { ReactiveFormsModule, FormsModule } from "@angular/forms";
I have tried different things after searching quite a bit and still getting this error:
Error: Uncaught (in promise): Error: NodeInjector: NOT_FOUND [ControlContainer]