I've an array of objects and I'm trying to get the values of it, although the variables inside are not predefined. The problem is that I don't know how to do that.
Array:
Array[3]: [
{
id: "1",
name: "name1",
lastname: "lastname1"
},
{
id: "2",
name: "name2",
lastname: "lastname2"
},
{
id: "3",
name: "name3",
lastname: "lastname3"
}
]
Javascript:
this.myFunction = function(response) {
var iLength = response.data.length;
for(var i=0;i<iLength;i++) {
var jLength = Object.keys(response.data[i]).length;
for(var j=0;j<jLength;j++) {
// ???
}
}
}
So instead of accessing the values this way,
response.data[i].id
response.data[i].name
response.data[i].lastname
I would rather access it in this way:
response.data[i]."somethingSomething[j]";
Is that possible? I'm fairly new to AngularJS, so I might be approaching this matter not in right way. Any help would be appreciated.
Edit: I have formulated my question better.