how to translate the html5 placeholders dynamically

praveenpds picture praveenpds · Jan 9, 2014 · Viewed 45.3k times · Source

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

DrDyne picture DrDyne · Feb 21, 2014

Did you try:

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