Topic: No provider for ControlContainer
blackcodespa pro asked 6 years ago
hi,in MDB Admin Template Pro (Angular version) 6.0.2 I try make a form<form [formGroup]="form" (ngSubmit)="onLogin()">
<div class="md-form">
<i class="fa fa-user prefix white-text"></i>
<input type="text" id="orangeForm-name" FormControlName="email" class="form-control" mdbInputDirective>
<label for="orangeForm-name" class="">Your name</label>
</div>
...
</form>
the error in console is "No provider for ControlContainer" when use [formGroup]
I add un app.module.ts
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
add in component
import { AbstractControl, FormGroup, Validators, FormControl } from '@angular/forms';
...
this.form = new FormGroup({
'email':newFormControl('', Validators.required ),
'password':newFormControl('', Validators.required),
});
Mariem_Jaouadi free answered 4 years ago
the AbstractControl did not work
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Answered
Specification of the issue
- ForumUser: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No
Tags
Damian Gemza staff commented 6 years ago
Dear blackcodespa, Please add FormsModule, ReactiveFormsModule also in views.module.ts file. This should help. Best Regards, Damianblackcodespa pro commented 6 years ago
thanks you have a nice day