0

I use

angular 5.1.2

angular-cli 1.6.2

When I run ng build --prod, I get the following error:

Chrome console

I looked in the docs, and also on SO, but I fail to see what is missing.

ng-serve runs perfectly, my pipe is dynamically updated, but on ng build--prod I get this error always.

This is how I register localeDE in app.module.ts

import { registerLocaleData } from '@angular/common';
import localeDE from '@angular/common/locales/de';
registerLocaleData(localeDE);

What else is needed for ng build--prod to run?

Roham Rafii
  • 2,929
  • 7
  • 35
  • 49
Schattenjäger
  • 331
  • 1
  • 3
  • 13

1 Answers1

0

Have not found why it doesn't work with the translate service. However, it seems that Angular in-built pipe does support dynamically changing locales. Thanks to ocombe. My problem with the inbuilt pipe was that I was using (with the setup above)

{{ASN.ClosedDateTime  | jsonDate | date:'dd.MM.yyyy EEEE HH:mm:ss':currentLanguage}}

instead of

{{ ASN.ClosedDateTime | jsonDate | date:'dd.MM.yyyy EEEE HH:mm:ss':'':currentLanguage }}.

I post it just for the case someone else has this typo.

Schattenjäger
  • 331
  • 1
  • 3
  • 13