RooksStrife RooksStrife - 2 months ago 24
AngularJS Question

How to pass a ng-repeat item as a value into Angular Translate?

It is easier to display this than explain it. I am trying to do this...

<div ng-repeat="label in itemLists">
<input id="{{label}}" type="checkbox">
<label for="{{label}}">{{'food.items.{{label}}' | translate}}</label>
</div>


The translate with the {{label}} is the issue. If I use food.items.cheese it works.

and inside of itemLists is

['lettuce', 'cheese', etc...]


food items is

{
"lettuce": "Lettuce",
"cheese": "American Cheese",
etc...
}

Answer

You can't have {{}} inside of {{}}.
How about 'food.items.' + label?