Я новичок в угловых вопросах, перепробовал все возможные способы, предложенные переполнением стека, но пока безуспешноFormGroup не является обязательным.Я уже добавил ReactiveFormsModule в app.module.ts и * .component.ts.Я использую Angular 8.x
Подробности:
Package Version
-----------------------------------------------------------
@angular/animations 8.2.7
@angular/cdk 8.2.0
@angular/cli 8.3.4
@angular/forms 8.2.7
@angular/http 7.2.15
@angular/material 8.2.0
@angular/router 8.2.7
@ngtools/webpack 8.3.4
@schematics/angular 8.3.4
@schematics/update 0.803.4
rxjs 6.4.0
typescript 3.5.3
webpack 4.39.2
=====================
Компонент html-файла
<div class="container">
<div class="row">
<div class="profile">
<form [FormGroup]="catCreate" class="example-form">
============================================
create-category.component.ts
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormBuilder, Validators, FormControl, ReactiveFormsModule } from '@angular/forms';
@Component({
templateUrl: './create-category.component.html', ...
})
export class CreateCategoryComponent implements OnInit {
catCreate: FormGroup; ...
===============================
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { CreateCategoryComponent } from './components/create-category/create-category.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MaterialsModule } from './material-module';
@NgModule({
declarations: [
AppComponent,
UploaderComponent,
CreateCategoryComponent
],
imports: [
MaterialsModule,
FormsModule,
ReactiveFormsModule,
.......
Error: Compiler.js:2175 Uncaught Error: Template parse errors:
Can't bind to 'FormGroup' since it isn't a known property of 'form'. ("a">
<form [ERROR ->][FormGroup]="catCreate" class="example-form">
ng:///AppModule/CreateCategoryComponent.html@8:30