I have the following template:
<form [formGroup]="entryForm" (ngSubmit)="onSubmit()">
<div class="view">
<div class="col">
<mat-form-field>
<textarea matInput value="Test..." formControlName="firstValue"></textarea>
</mat-form-field>
</div>
<button type="submit">Submit</button>
</div>
</form>
Component:
ngOnInit() {
this.entryForm = new FormGroup({
firstValue: new FormControl('')
});
}
public onSubmit() {
console.log(this.entryForm.value);
}
But when I click on submit, the value of firstValue
appears to be empty. Even though I see it in the input form because of the value
property.