First add below code in your TS file :
import { Component} from ‘@angular/core’;
import { FormBuilder, FormGroup } from ‘@angular/forms’;
export class YourPage {
public commentForm : FormGroup;
constructor(public _FB: FormBuilder) {
this.commentForm = _FB.group({
comment: Validator.feedCreateValidator
});
}
resetForm()
{
this.commentForm.reset();
}
}
Note : Just call “resetForm()” method from your template. It will reset your form.
This will reset your form data.
No comments:
Post a Comment