AngularJS: How to translate md-placeholder?

I have a very simple datepicker using AngularJS and I want to give it a placeholder to translate it using AngularJS translate (as usual in my project).

Here's my HTML:

<div flex class="layout-row">
        <md-datepicker ng-model="vm.calendarEvent.start" ng-model-options="{ timezone: 'UTC' }" md-placeholder="Une date" translate translate-md-placeholder="PROF.SHARE.DUE">
        </md-datepicker>
</div>

      

Running this error throws this error:

Error: [$ compile: multidir] Several directives [mdDatepicker (module: material.components.datepicker), translate (module: pascalprecht.translate)] request new / allocated volume to:

<md-datepicker class = "ng-pristine ng-untouched ng-valid _md-datepicker-has-triangle-icon" ng-model = "vm.calendarEvent.start" ng-model-options = "{timezone: ' UTC '} "md-placeholder =" Une date "translate =" translate-md-placeholder = "PROF.SHARE.DUE">

+3


source to share


1 answer


I think you are looking for this inline translation to md-placeholder

:



<div flex class="layout-row">
  <md-datepicker ng-model="vm.calendarEvent.start" 
                 ng-model-options="{ timezone: 'UTC' }" 
                 md-placeholder="{{ 'PROF.SHARE.DUE' | translate  }}">
  </md-datepicker>
</div>

      

+3


source







All Articles