alguém sabe qual é meu problema?
compiler.js:1021 Uncaught Error: Template parse errors:
Can't bind to 'formGroup' since it isn't a known property of 'form'. ("<form [ERROR ->][formGroup] ="formulario" class= "container" action="">
<div id="title">
<h2 class="h2 te"): ng:///SocioModule/CadastrarSocioComponent.html@0:6
No provider for ControlContainer ("[ERROR ->]<form [formGroup] ="formulario" class= "container" action="">
<div id="title">
<h2 class="): ng:///SocioModule/CadastrarSocioComponent.html@0:0
No provider for NgControl ("<div class="form-group col-md-6">
<label for="nome">Digite seu nome</label>
[ERROR ->]<input formControlName="nome" id="nome"type="text" class="form-control" placeholder="nome completo">
"): ng:///SocioModule/CadastrarSocioComponent.html@8:12
No provider for NgControl (" <div class="form-group col-md-6">
<label for="cpf">Digite seu CPF</label>
[ERROR ->]<input formControlName="cpf" id="cpf" type="text" pattern="[0-9]{11}" class="form-control">
<"): ng:///SocioModule/CadastrarSocioComponent.html@12:12
at syntaxError (compiler.js:1021)
at TemplateParser.push../node_modules/@angular/compiler/fesm5/compiler.js.TemplateParser.parse (compiler.js:14830)
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._parseTemplate (compiler.js:24018)
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileTemplate (compiler.js:24005)
at compiler.js:23948
at Set.forEach (<anonymous>)
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileComponents (compiler.js:23948)
at compiler.js:23858
at Object.then (compiler.js:1012)
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents (compiler.js:23857)
component:
import { Component, Input } from '@angular/core';
import { FormGroup ,FormBuilder , Validators } from '@angular/forms'
import { OnInit } from '@angular/core';
@Component ({
selector: 'vox-socio',
templateUrl: './cadastrarSocio.component.html',
styleUrls: ['./cadastrarSocio.component.css']
})
export class CadastrarSocioComponent implements OnInit{
formulario : FormGroup;
constructor(private formBuilder: FormBuilder){}
ngOnInit(): void {
this.formulario = this.formBuilder.group({
nome: ['',
[
Validators.required,
Validators.maxLength(255)
],
],
cpf: ['',
[
Validators.required,
Validators.pattern('[0-9]{11}')
]
]
});
}
}
HTML:
<form [formGroup] ="formulario" class= "container" action="">
<div id="title">
<h2 class="h2 text-center">Vox Tecnologia</h2>
<h5 class="h5 text-center">Cadastro de Sócios</h5>
</div>
<div class="form-row" id="formulario">
<div class="form-group col-md-6">
<label for="nome">Digite seu nome</label>
<input formControlName="nome" id="nome"type="text" class="form-control" placeholder="nome completo">
</div>
<div class="form-group col-md-6">
<label for="cpf">Digite seu CPF</label>
<input formControlName="cpf" id="cpf" type="text" pattern="[0-9]{11}" class="form-control">
</div>
<button type="submit" class="btn btn-primary">cadastrar</button>
</div>
</form>