praveenpds praveenpds - 5 months ago 51
AngularJS Question

how to translate the html5 placeholders dynamically

I'm using angular-translate to translate the page content in to different languages.

<input type ='text' placeholder = ' {username | translate}'>


This works fine when the page loads ..but it fails to translate when I use
$translate.uses('fr')
depending upon language dropdown changes.

Can any one kindly suggests the solution to translate the placeholders while the language changes dynamically ?

Answer

Did you try:

<input type="text" placeholder="{{ 'my.i18n.key' | translate }}" ng-model="myModel">