remove Method
Resets the current value of the form control, form group, or form array back to its initial state
API
remove(): void;
Example
import {FormControl, FormGroup} from '@angular/forms';
import {formSource} from '@bitfiber/ng/rx';
interface FormValue {
itemId: number;
search: string;
}
// Creates a form group
const formGroup = new FormGroup({
itemId: new FormControl(1, {nonNullable: true}),
search: new FormControl('', {nonNullable: true}),
});
// Creates a form source
const source = formSource<FormValue>(formGroup);
// Resets the current form value to its initial state
const value = source.remove();