Answer the question
In order to leave comments, you need to log in
How to get value from array in Angular.JS?
Hello!
I apologize in advance for the incredibly noob question. There was a need for a small editing of a template written in Angular, and I am completely zero in it.
The template has this entry:
<tr ng-repeat="item in data.order.contacts">
<td><b>{{item.label}}:</b></td>
<td>{{item.value}}</td>
</tr>
Answer the question
In order to leave comments, you need to log in
item
is a reference to an array element, ng-repeat is analogous to forEach.
Accordingly, item contains all the fields of the data.order.contacts array element. item.<field_name>
and there is a specific value of a specific parameter.
If you are talking about a specific element of the array, then it data.order.contacts[element_index]
will lead you to it :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question