Is this possible to achieve a code like this:-
<tr ng-repeat="data in dataArray,value in valueArray">
{{data}} {{value}}
</tr>
I am having two arrays I want to show them in single row.
PS: I am not asking for syntax. I am looking for logic to achieve this
Thanks
Like :- "http://jsfiddle.net/6ob5bkcx/1/"
You should be doing this in the controller, not in the view. Map the dataValues into a key/value pair object and reference the values array using an index. This assumes that each data key has a corresponding value key.
Controller:
View:
If you have, for any reason, two arrays with the same length and where their contents are corresponding (
array1[0]
correspond toarray2[0]
, ...,array1[n]
correspond toarray2[n]
), you can use AngularJS'strack by
(which was introduced for the 1st time in the version 1.1.4) like this for example :Hope that can help.
if you want something like a list with two or more items in the same row:
in html file:
in js file:
Angular ng-repeat does not support it but still you can write your own custom directive according to your requirements.
Update Section
This directive will be generic to traverse list of collections and yes in the above code there can be some syntactical errors because i did not run it. Its your luck.
Does this suits your need
http://jsfiddle.net/jmo65wyn/
Your data, value array as object array
And you loop like this