Reputation: 518
I use angular-translate to localise my app and display my string inside brackets {{"TEA_BREAK" | translate}}
. Now, I want to store those strings {{"TEA_BREAK" | translate}}
inside an array:
array = [ "{{'TEA_BREAK' | translate}}", "{{'TEA2_BREAK' | translate}}"];
Obviously that doesn't work. I did try different variations, with brackets, without brackets etc. Nothing works. I wonder what would be the best way to do that?
Upvotes: 0
Views: 565
Reputation: 594
I think you should use $filter service to translate these text.
Inject $filter service
function MyController($filter)
Then translate your text like this:
array.push($filter('translate')('TEA_BREAK'));
Upvotes: 2