2

I'm trying to update my language change hardcoded placeholder

so I have <input type="text" placeholder="{{placeholderText}} /> and in my angular controller $scope.placeholderText =filter("translate")("label");

but when the language is updated the placeholder remains in the original language.

also is there a way to hide the placeholder's {{placeholderText}} uppon loading the page, before the translate kicks in.

Kiwi
  • 2,713
  • 7
  • 44
  • 82

1 Answers1

2

Just create a ternary statement within your data-binding, using some variable of your choice.

placeholder="{{ finishedTranslating ? placeholderText : '' }}"

Then within your scope after it translates just flip that finishedTranslating variable to true:

$scope.finishedTranslating = true;

Note: Ability to use ternary operators was added to data-binding in Angular 1.1.5

Mark Pieszak - Trilon.io
  • 61,391
  • 14
  • 82
  • 96