Search code examples
javascriptangularjsjsonsanitizationangular-translate

angular-translate issue when interpolating parameters with escapeParameters sanitization


I'm encountering a weird issue (no translation displayed) when using angular-translate, with parameters interpolation as date objects.

But first things first: here's the plunker.

.

Using a sanitization strategy 'escapeParameters' in the translate provider,

why with a json formatted like this:

$scope.title = { day: 'tomorrow', today: new Date() };

the results of my translations are always {}, using the contracted forms

{{'VARIABLE_REPLACEMENT' | translate : title}}

<translate="VARIABLE_REPLACEMENT" translate-values="{ day: 'tomorrow', today: title.today }">

As you can see, the other ways of using angular-translate seems to work fine. Is this some kind of bug? Or i am doing something wrong?


Solution

  • For everyone wondering, i opened a issue on github repository of angular-translate: this problem will be fixed in 2.11.2 (next version of the current release). More on the issue here.