6

My question is how can I use item from ng-repeat on the same tag I am declaring ng-repeat

What I need (in some abstract template language):

{% for item in items %}
     <li data-theme="{{ item.dataTheme }}">{{ item.name }}</li>
{% endfor %}

With angular I do not know how to access that item.dataTheme

<li data-theme="{{ item.dataTheme }}" ng-repeat="item in items">{{ item.name }}</li>
Vladimir Nani
  • 2,774
  • 6
  • 31
  • 52

1 Answers1

12

You can use

<li data-theme="{{ item.dataTheme }}" ng-repeat="item in items">{{ item.name }}</li>

Demo: Fiddle

Arun P Johny
  • 384,651
  • 66
  • 527
  • 531
  • Wow that is straightforward....:) I guess I was trying to do `
  • ` to insert raw html... and that didnt work out. Thanks for answer.
  • – Vladimir Nani Aug 31 '13 at 10:26
  • 4
    how it's differs with posted one? Or OP edit own question with answer? – vp_arth Jul 27 '15 at 08:08
  • It sounds like the OP tried some code that failed, but when he wrote the question he wrote different - and correct! - code, which is pretty amazing. – Josh Gagnon May 12 '16 at 15:40