I am trying to use angular translate to display something like - Posted By John Doe on 1st Jan,2016 - where John Doe and 1st Jan,2016 are dynamic scope variables.
So, I have something like
<p translate="TRANSLATION-STRING" translate-values='{ name: myname, date:mydate }'></p>
and translation string defined as TRANSLATION-STRING: "Posted on {{ name}} by {{date}}"
So far it is fine but what I have is a very long date and so i want to apply a date filter to the translate-value, something like
<p translate="TRANSLATION-STRING" translate-values='{ name: myname, date:mydate|date:'MMM dd , yyyy' }'></p>
This does not seem to work. How can a filter be applied in view and passed to angular translate value?
I had the same issue, and it appears that using parenthesis around the individual data elements works. Try this:
<p translate="TRANSLATION-STRING" translate-values='{ name: myname, date: (mydate | date:'MMM dd , yyyy') }'></p>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With