I want to do a ng-repeat on an array which is composed of two arrays, like this :
[titles: [], links: []]
My arrays (titles and links) have the same length What i want to print in my ng-repeat, finally, is anything like that :
{{ array.title }}
{{ array.link }}
For example, in a C program i have to do that :
int i;
i = 0;
while (titles[i])
{
printf("%s - %s", titles[i], links[i]);
i++;
}
If the length is the same, then make it an object rather than two arrays.
plunker
This is how it worked for me:
I had both product.names and product.prices of same size
It's not clear how you have your data —
[titles: [], links: []]
isn't meaningful.Ideally you would arrange your data as an array of objects that looks like:
Then you could just use:
If you know that titles and links will always be the same size you can do this, but it's not very pretty and might be a little fragile: