AngularJS: 如何翻译 md-placeholder?
AngularJS: How to translate a md-placeholder?
我有一个使用 AngularJS 的非常简单的日期选择器,我想给它一个占位符来使用 AngularJS translate 来翻译它(就像我在我的项目中通常做的那样)。
这是我的 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>
这样做会抛出这个错误:
Error: [$compile:multidir] Multiple directives [mdDatepicker (module:
material.components.datepicker), translate (module:
pascalprecht.translate)] asking for new/isolated scope on:
< 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">
我认为您正在 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>
我有一个使用 AngularJS 的非常简单的日期选择器,我想给它一个占位符来使用 AngularJS translate 来翻译它(就像我在我的项目中通常做的那样)。
这是我的 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>
这样做会抛出这个错误:
Error: [$compile:multidir] Multiple directives [mdDatepicker (module: material.components.datepicker), translate (module: pascalprecht.translate)] asking for new/isolated scope on:
< 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">
我认为您正在 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>