mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
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:
@@ -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 {}
|
||||
```
|
||||
|
Reference in New Issue
Block a user