Topic: No provider for ControlContainer

Tech Team free asked 6 years ago


app.componenet.ts contains :- import { Component } from \'@angular/core\'; import { AbstractControl, FormGroup, FormBuilder, Validators } from \'@angular/forms\'; @Component({ selector:\'app-root\', templateUrl:\'./app.component.html\', styleUrls: [\'./app.component.scss\'] }) export class AppComponent { text:string loginForm:FormGroup; constructor(privatefb:FormBuilder) { this.loginForm=fb.group({ defaultFormEmail: [\'\', Validators.required], defaultFormPass: [\'\', [Validators.required, Validators.minLength(8)]] }); } } app.module.ts contains import { BrowserModule } from \'@angular/platform-browser\'; import { NgModule, NO_ERRORS_SCHEMA } from \'@angular/core\'; import { BrowserAnimationsModule } from \'@angular/platform-browser/animations\'; import { AppComponent } from \'./app.component\'; import { AgmCoreModule } from \'@agm/core\'; import { MDBBootstrapModule } from \'./typescripts/free\'; import { FormsModule, ReactiveFormsModule } from \'@angular/forms\'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, BrowserAnimationsModule, MDBBootstrapModule.forRoot(), FormsModule, AgmCoreModule.forRoot({ // https://developers.google.com/maps/documentation/javascript/get-api-key?hl=en#key apiKey:\'Your_api_key\' }) ], providers: [], bootstrap: [AppComponent], schemas: [ NO_ERRORS_SCHEMA ] }) export class AppModule { } app.component.html contains <form [formGroup]=\"loginForm\"> <pclass=\"h5 text-center mb-4\">Sign in</p> <divclass=\"md-form\"> <iclass=\"fa fa-envelope prefix grey-text\"></i> <inputtype=\"text\"formControlName=\"defaultFormEmail\"id=\"defaultForm-email\"class=\"form-control\"mdbInputDirective> <labelfor=\"defaultForm-email\">Your email</label> </div> <divclass=\"md-form\"> <iclass=\"fa fa-lock prefix grey-text\"></i> <inputtype=\"password\"formControlName=\"defaultFormPass\"id=\"defaultForm-pass\"class=\"form-control\"mdbInputDirective> <labelfor=\"defaultForm-pass\">Your password</label> </div> <divclass=\"text-center\"> <inputtype=\"submit\"class=\"btn btn-default waves-light\"mdbWavesEffectvalue=\"Login\"> </div> </form> I am gettingUncaught Error: Template parse errors:No provider for ControlContainer (\"[ERROR ->]<form [formGroup]=\"loginForm\">

Damian Gemza staff commented 6 years ago

Please import ReactiveFormsModule in your app.module.ts to fix this error. Best Regards, Damian


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags