I'm writing my own component and want to do custom reset (I need to cleanup some labels and etc.)
So, when somebody call this.form.reset(); I want to respond to this event and make some cleanup actions.
I don't want to ask developer to send custom reset for my component like
this.form.reset({myControl: null})
I just want to react on form reset. Could you help me? How I can do it? I use ReactiveAngular Forms
Example:
<form ...>
<my-own-component formControlName="fieldName"></my-own-component>
</form>
Subscribe on status changes of the form and on next tick check the pristine status if it is true - form was reset.
ngOnInit(): void {
this.formGroup.statusChanges.subscribe(x => {
setTimeout(()=>console.log(this.formGroup.pristine),0);
});
}