Here is the template code:
<form [formGroup]="form" (ngSubmit)="onSubmit(form.value)" novalidate="novalidate">
<textarea [ngClass]="{ 'error': comment }"
[formControl]="form.controls['comment']"
placeholder="Comment...."></textarea>
<div class="form-group">
<button type="submit" id="template-contactform-submit"
name="template-contactform-submit"
value="submit">Enter</button>
</div>
This is the TypeScript code:
for(var prop in form) {
if(this.form.controls.hasOwnProperty(prop)) {
this.form.controls[prop].setValue(" ");
}
}
An error " setValue does not exists on type AbstractControl" is being displayed.