UNPKG

@qoollo/ngx-form-url-saver

Version:

Angular directive for syncing form's data with URL query

21 lines (20 loc) 957 B
import { Params } from '@angular/router'; export interface QueryGenerationStrategy { /** * Responsible for obtaining the form value from query parameters. * Can additionally rely on the value of the form, for example, to find out which keys are present in it * @param queryParams value of query parameters * @param formValue form value */ inferFormValueFromQuery(queryParams: Params, formValue: Record<string, unknown>): object; /** * Converts the form value to an object that can be passed to the router for affixing * query parameters */ convertFormValueToQueryObject(formValue: Record<string, unknown>): object; /** * Returns an object that should be passed to the router to remove query parameters. * Can additionally rely on the value of the form, for example, to find out which keys are present in it */ createClearingObject(formValue: Record<string, unknown>): object; }