2

I have a repeater within a repeater, like so:

<div ng-repeat='x in collection1'>
    <div ng-repeat='y in collection2'>
    </div>
</div>

What I'm trying to do is access property y of object x, something like...

{{ x.{{y} }}}

or

{{ x[ {{y}} ] }}

...but when I try this I get an error along the lines of..."Syntax Error: Token 'y' is unexpected, expecting [:]."

Is there any way to do something like this with Angular or am I boned here?

E-Rock
  • 180
  • 7
  • possible duplicate of [How to access object using dynamic key?](http://stackoverflow.com/questions/6921803/how-to-access-object-using-dynamic-key) – Stewie Jul 01 '13 at 23:36

1 Answers1

6
{{ x[y] }}

Here's a jsfiddle, though the example is a bit contrived.

ty.
  • 10,924
  • 9
  • 52
  • 71
  • Thanks. This was actually the first thing I'd tried, but it turns out my object wasn't set up like I expected. I was looking for x[firstName] when I needed x.name[first] etc. – E-Rock Jul 02 '13 at 13:59