Property formGroup is not provided by any applicable directives nor by form element (Specifically Angular CLI 13.0.4)

Viewed 1029

This is not an issue with importing ReactiveFormsModule or the FormsModule

I already have those imported in app.module.ts and in the module where I am having this issue:

  imports: [
    BrowserModule,
    AppRoutingModule,
    FormsModule,
    ReactiveFormsModule,
    ...

So this error occurs when I add the [formGroup] property and the formControlName attribute to the .html file

<form  [formGroup]="loginForm" (ngSubmit)="doLogin()" class="m-t" role="form" action="index.html">
  <div class="form-group">
    <input type="email" class="form-control" formControlName="username" placeholder="Username" required="">
  </div>
  <div class="form-group">
    <input type="password" class="form-control" formControlName="password" placeholder="Password" required="">
  </div>
</form>

This error started after I upgraded the CLI from 12.1.0 to 13.0.4

If I downgrade to the previous version, the error goes away.

I have deleted the node modules folder and re-run npm install

Since this version of the CLI was released 7 days ago, I can't find any solutions to this error. I have also gone to the angular cli issues page on Github and nothing has been raised there yet.

I'd appreciate any suggestions to fix this. Downgrading is not an option.

0 Answers
Related