Skip to content
Source
Sign inSign up
TanStack/form
Open History to see the last commit

inject-form.ts

13 lines439 Bytes

1import { FormApi, type FormOptions, type Validator } from '@tanstack/form-core'
2import { injectStore } from '@tanstack/angular-store'
3​
4export function injectForm<
5 TFormData,
6 TFormValidator extends Validator<TFormData, unknown> | undefined = undefined,
7>(opts?: FormOptions<TFormData, TFormValidator>) {
8 const api = new FormApi<TFormData, TFormValidator>(opts)
9​
10 injectStore(api.store, (state) => state.isSubmitting)
11​
12 return api