RooksStrife
RooksStrife

Reputation: 1747

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

Upvotes: 2

Views: 124

Answers (1)

George Kagan
George Kagan

Reputation: 6124

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

Upvotes: 1

Related Questions