1

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.

What I want to do is translating a static translation key with 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:

<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.

Is there any way I can use this one time binding in combination with angular-translate?

Here is a plunker replicating my issue

Niklas
  • 417
  • 6
  • 17
  • It might be worth filing a bug in the bindonce repository for this. The `README` in the repo specifically states that filters can be used in this way. – Tom A Sep 25 '14 at 15:42

1 Answers1

0

Try:

<div bindonce="languages">  <div bo-bind="'TEST' | translate"></div></div>

in controller just set scope "language" = true when angular-translate build complete. I think you should use rootscope for saving "language"

Hai Bui
  • 303
  • 1
  • 2
  • 9