I'm making a small app, which takes a typed message on the form, and writes it on the console.I tried to import several items, and I found problems similar to mine on the internet, but they didn't help me. I'm getting this error:
Can't bind to 'formGroup' since it isn't a known property of 'form'.
HTML:
<div class="content" role="main">
<a>
<form [formGroup]="pushForm"> <!--Show the error here -->
<label>Titulo:</label>
<input class="form-control" formControlName="titulo">
<label>Menssagem:</label>
<input class="form-control" formControlName="menssagem">
<button (click)="printConsole();" >Enviar Menssagem</button>
</form>
</a>
</div>
<router-outlet></router-outlet>
.ts archive:
import { Component, NgModule } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
@NgModule({
imports: [
BrowserModule
],
})
export class AppComponent {
pushForm = new FormGroup ({
titulo: new FormControl(),
mensagem: new FormControl(),
});
printConsole() {
console.log("Menssagem: "+ this.pushForm);
}
}