[英]AngularJS: bo-bind of bindonce and the translate filter
I'm using angular 1.2.25
, angular-translate 2.0.1
, angular-translate-loader-static-files 2.0.0
and angular-bindonce 0.3.1
. 我正在使用
angular 1.2.25
, angular-translate 2.0.1
, angular-translate-loader-static-files 2.0.0
和angular-bindonce 0.3.1
。
What I want to do is translating a static translation key with bindonce. 我想要做的是使用bindonce翻译静态翻译键。 So I got this code snippet:
所以我得到了以下代码片段:
<div bindonce>
<div bo-bind="'TEST' | translate"></div>
</div>
As result of this snippet the translation key is displayed instead of the translation. 作为此摘要的结果,将显示翻译键而不是翻译。 If I'm using now
ng-bind
instead of bo-bind
everything works just fine: 如果我现在使用
ng-bind
而不是bo-bind
一切都很好:
<div>
<div ng-bind="'TEST' | translate"></div>
</div>
I have stepped through with the debugger and it seems like the translate filter doesn't exist when bo-bind
is executed. 我已经调试过调试器,执行
bo-bind
时似乎不存在翻译过滤器。
Is there any way I can use this one time binding in combination with angular-translate? 有什么方法可以结合角度转换使用一次绑定吗?
Try: 尝试:
<div bindonce="languages"> <div bo-bind="'TEST' | translate"></div></div>
in controller just set scope "language" = true when angular-translate build complete. 在控制器中,只需在完成angular-translate构建时将范围设置为“ language” = true。 I think you should use rootscope for saving "language"
我认为您应该使用rootscope保存“语言”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.