123
rated 0 times
[
128]
[
5]
/ answers: 1 / hits: 11475
/ 10 Years ago, fri, september 19, 2014, 12:00:00
I'm repeating over an array of objects and I want my variable in the loop to refer to just one property of each object.
Simplified data example:
var data = [
{
'name': {
'first': 'John',
'last': 'Johnson'
}
'age': 45
},
{
'name': {
'first': 'Larry',
'last': 'Wilson'
}
'age': 45
}
]
I could do:
<div ng-repeat=person in data>{{ person.name.first }}</div>
But what I'd prefer to do is to just focus in on the only part of the object I'm using and do something like this:
<div ng-repeat=person.name in data as name>{{ name.first }}</div>
But that doesn't seem to be working -- is this possible currently?
More From » angularjs