Angular 2 date pipe

I am using this code:

{{today | date:'General.dateFormat | translate'}} 

where General.dateFormat is the MM.dd.yyyy format, a JSON file stored in my language. But it prints as 5 22, 2017 AenerPMl.22PMteFor35PMt | trPMn24lPMte 5 22, 2017 AenerPMl.22PMteFor35PMt | trPMn24lPMte

I think there is a problem with multiple pipes. If I replace General.dateFormat | translate General.dateFormat | translate to MM.dd.yyyy , it works as it should. How to transfer format from my json language file using broadcast channel?

+5
source share
1 answer

You have transmitted the pipe as filters that match the latest values. pass the value directly instead of passing General.dateFormat as a string. please try the code below

 {{today | date: translate:'General.dateFormat'}} 
+2
source

Source: https://habr.com/ru/post/1268092/


All Articles