我正在尝试更新我的语言更改硬编码占位符
所以我有
<input type="text" placeholder="{{placeholderText}} />
在我的 Angular Controller 中
$scope.placeholderText =filter("translate")("label");
但是当语言更新时,占位符仍保留原始语言。
还有办法隐藏占位符的 {{placeholderText}}
加载页面后,在翻译开始之前。
最佳答案
只需使用您选择的某个变量在数据绑定(bind)中创建一个三元语句。
placeholder="{{ finishedTranslating ? placeholderText : '' }}"
然后在翻译后的范围内,只需将 finishedTranslated
变量翻转为 true:
$scope.finishedTranslating = true;
Note: Ability to use ternary operators was added to data-binding in Angular 1.1.5
关于javascript - 占位符的 Angular 翻译更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28989077/