javascript - How we can display two ng-repeat alternately one by one -
i have 2 ng-repeat want display them in grid 1 one alternately both of tr's. first index of first tr first index of 2nd tr. if appreciable. in advance.
create function weave 2 arrays together. this:
function combine(arr1, arr2){ var result = []; for(var i=0; < arr1.length; i++){ result.push(arr1[i]); result.push(arr2[i]); } return result; }
(this simple example, , doesn't account arrays being different sizes.)
then can assign $scope
variable result of function, , use variable in ng-repeat
.
Comments
Post a Comment