Edit to add a clear question: I have a flat array of some length and I want to put it into a tr/td type view? This might also be in a bootstrap grid or somethin
maybe this could work to someone, you never know
the following code will assign an extra value (store_chunk) to an array of stores. so I can use with ng-repeat to show 3 different columns in my HTML
var x = 0;
var y = 1;
var how_many_chunks = 3;
var limit = $scope.main.stores.length / how_many_chunks ;
angular.forEach($scope.main.stores, function(e, key) {
if (x <= limit) {
$scope.main.stores[key].store_chunk = y;
}
else{
y += 1;
limit = y * limit;
$scope.main.stores[key].store_chunk = y;
}
x += 1;
});
here the HTML
- {{store.store_name}}
- {{store.store_name}}
- {{store.store_name}}
this works like a charm! and don't vote down just because you didn't like it!.. thumbs up instead!