Skip to content

Commit

Permalink
Docs: Defining FormObject validator with FormGroupOptions (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
thabalija authored Jan 15, 2025
1 parent 4ce1ba7 commit c4601eb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docusaurus/docs/guides/validating-forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,16 @@ Validator object will be used only for `Attribute` and `HasMany` relationships.
## Defining FormObject validator with `FormGroupOptions`

To validate a `FormStore` instance as a whole, a validator can be provided via `formGroupOptions` on `FormObject`.

This can be used for validating the `BelongsTo` relationships.

```ts title="user.form-object.ts"
import { Validators } from '@angular/forms';
...
public formGroupOptions: FormGroupOptions = {
validator: (form: FormStore) => {
...
},
};
...
```
13 changes: 13 additions & 0 deletions docusaurus/versioned_docs/version-9.0.0/guides/validating-forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,16 @@ Validator object will be used only for `Attribute` and `HasMany` relationships.
## Defining FormObject validator with `FormGroupOptions`

To validate a `FormStore` instance as a whole, a validator can be provided via `formGroupOptions` on `FormObject`.

This can be used for validating the `BelongsTo` relationships.

```ts title="user.form-object.ts"
import { Validators } from '@angular/forms';
...
public formGroupOptions: FormGroupOptions = {
validator: (form: FormStore) => {
...
},
};
...
```

0 comments on commit c4601eb

Please sign in to comment.