AAE-30864 Refactored services to accept injected validators (#10660)

* [AAE-30864] refactored services to accept injected validators

* [AAE-30864] updated documentation, applied pr comments
This commit is contained in:
tomasz hanaj
2025-02-20 09:22:17 +01:00
committed by GitHub
parent 70d899f5ba
commit f39f104d45
10 changed files with 249 additions and 15 deletions

View File

@@ -191,3 +191,32 @@ class MyComponent {
- `handleError(error: any):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
Reports an error message.
- `error` - Data object with optional \`message\` and \`status\` fields for the error
### Properties
| Name | Type | Description |
| ---- | --------- | ----------- |
| fieldValidators | FormFieldValidator[] | Array of Field Validators injected with token and then passed to FormModel |
### Inject Preference service
Token: [`FORM_SERVICE_FIELD_VALIDATORS_TOKEN`]
A DI token that allows to inject additional form field validators.
```ts
import { NgModule } from '@angular/core';
import { FORM_SERVICE_FIELD_VALIDATORS_TOKEN } from '@alfresco/adf-core';
@NgModule({
imports: [
...Import Required Modules
],
providers: [
{
provide: FORM_SERVICE_FIELD_VALIDATORS_TOKEN,
useValue: [new AdditionalFormFieldValidator()]
}
]
})
export class ExampleModule {}
```