ng-bootstrap-form-validation icon indicating copy to clipboard operation
ng-bootstrap-form-validation copied to clipboard

[Question] ngx-translate support?

Open pouletfou opened this issue 6 years ago • 3 comments

Hello

I'd like to use this with ngx-translate. Is this somewhere on your roadmap?

pouletfou avatar Mar 25 '19 21:03 pouletfou

Same question here

Hesesses avatar Jul 18 '19 09:07 Hesesses

Any ideas when this feature would be implemented?

samiv22 avatar Aug 13 '19 12:08 samiv22

Yes, you can use it easily.

In app.module.ts (before you have to config TranslateModule): providers: [ TranslateService, { provide: CUSTOM_ERROR_MESSAGES, useFactory: CustomErrorFactory, deps: [TranslateService], multi: true } ],

xy.ts: export const CustomErrorFactory = (translateService: TranslateService): ErrorMessage[] => { return [ { error: "required", format: (label, error) => requiredFormat(label, error, translateService) } ]; }

export function requiredFormat(label: string, error: any, translateService: TranslateService): string { return translateService.instant('RequiredErrorMessage'); }

pepe19000 avatar Dec 12 '19 12:12 pepe19000