简体   繁体   中英

Can't bind to 'formGroup' since it isn't a known native property

I have upgraded my application from Angular 2 to Angular 6 version. ng build --prod is building application successfully. I am able to login into my application and 50% functionality is working perfectly where some of the options are not working and throwing below exception:

EXCEPTION: Error: Uncaught (in promise): Template parse errors: Can't bind to 'formGroup' since it isn't a known native property (" <form class="form-inline" [ERROR ->][formGroup]="xSearchForm" (ngSubmit)="onSubmit()"> "): a@5:34

Can't bind to 'formControl' since it isn't a known native property ("abel> <input type="text" class="form-control pull-right" [(ngModel)]="model.xxx" [ERROR ->][formControl]="xSearchForm.find('yyy')" id="xxx" /> "): a@13:93

I am importing FormsModule and ReactiveFormsModule in app.module.ts and added these imports in NgModule imports also.

You need to import ReactiveFormsModule in your AppModule or in the module where your component is declared.

  import { FormsModule, ReactiveFormsModule } from '@angular/forms';

  ... 
  ...

  imports: [
    FormsModule,
    ReactiveFormsModule
  ]

ReactiveFormsModule is defined in @angular/forms

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM