2.1.0 (2020-07-13)
- add touch and dirty status reaction (20c435e)
2.0.0 (2020-07-05)
- update pipe creation and usage (ad000db)
- update readme and package.json (8adbfab)
- update project to angular 9 (f1b6410)
- complete update to angular 9
- add structural directive for controlled errors management
- add standard names for components
- update to angular 8
- add structural directive for controlled errors management
The 1.0.0 version is compatible with angular 8.
The components have been renamed according to the angular conventions, now they starts with the library prefix. Update this
<form [formGroup]="heroForm" validationContext="USER.REGISTRATION">
<div formFieldContainer>
<label>Name</label>
<input formControlName="name"/>
</div>
</form>
changing the name to ngxValidationErrorsField
<form [formGroup]="heroForm" validationContext="USER.REGISTRATION">
<div ngxValidationErrorsField>
<label>Name</label>
<input formControlName="name"/>
</div>
</form>
The old names are still available bu consider it deprecated!
The 0.3.0 version removes the dependency from @ngx-translate/core to allow using the library also without this @ngx-translate or with this or other similar libraries
To update you need to modify the app.module.ts like this:
import {MESSAGES_PIPE_FACTORY_TOKEN, MESSAGES_PROVIDER, NgxValidationErrorsModule} from '@xtream/ngx-validation-errors';
export function translatePipeFactoryCreator(translateService: TranslateService) {
return (detector: ChangeDetectorRef) => new TranslatePipe(translateService, detector);
}
@NgModule({
providers: [
{
provide: MESSAGES_PIPE_FACTORY_TOKEN,
useFactory: translatePipeFactoryCreator,
deps: [TranslateService]
},
{
provide: MESSAGES_PROVIDER,
useExisting: TranslateService
}
]
})
The function returns a factory that is used by the library to create a pipe and pass a ChangeDetectorRef instance so on lang change (or similar event) the components can be updated accordingly.
If you want to use a custom error mapping without translation you can provide your custom pipe and message provider (that exposes an instant(key:string):string
method)
like this:
import {MESSAGES_PIPE_FACTORY_TOKEN, MESSAGES_PROVIDER, NgxValidationErrorsModule} from '@xtream/ngx-validation-errors';
export function simpleCustomPipeFactoryCreator(messageProvider: SimpleMessagesProviderService) {
return (detector: ChangeDetectorRef) => new SimpleErrorPipe(messageProvider, detector);
}
@NgModule({
providers: [
{
provide: MESSAGES_PIPE_FACTORY_TOKEN,
useFactory: simpleCustomPipeFactoryCreator,
deps: [SimpleMessagesProviderService]
},
{
provide: MESSAGES_PROVIDER,
useExisting: SimpleMessagesProviderService
}
]
})
- remove dependency form @ngx-translate
- add imperative validation clearing
- array: add array controls validation
- change forRoot method to work with AOT
- change module import for lazy loading error
- add class is-invalid correclty on error 89fb90e
- fallback strategy of error messages 3b5a029
- FormFieldContainer selector in kebab-case 35db7ae