Search code examples
angularjsangular-translate

Angular translate: Variable replacement with filtering by date


how can I apply filter to the dynamic translate variable? I use something like this, but it doesn't work:

{{'REGISTER_PAGE_USER.BIRTHDAY_MIN_DATE'
   | translate:'{ minimum: (minDate | date:'MMMM dd yyyy') }'}}

Would appreciate any help


Solution

  • You can apply the filter in the controller like so:

    $scope.minDate = $filter('date')(minDate, 'MMMM dd yyyy');
    

    This way you don't have to do it in your template.

    Date documentation here.