To display a certain element multiple times in a row, I am looking for a way that does not involve using the do(x times)
function in Angular or adding extra functions in the controller.
If we consider
?Array.from({length:5})
(5) [undefined, undefined, undefined, undefined, undefined]
Is there a way to modify the following code to achieve the desired result without relying on additional functions or filters in the controller (and without using a controller at all)?
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js">
</script>
<div ng-app>
[1,2] - OK:
<div ng-repeat="x in [1,2]">
> {{x}}
</div>
Array.from({length:5}) - NOK:
<div ng-repeat="x in Array.from({length:5})">
> {{x}}
</div>
</div>
PS
I need 5 ">
" symbols displayed instead of numbers.
PPS.
Practical scenario:
I need to show the last page of a paginated table based on "availableRowsNumber" and "itemsPerPage". To ensure a consistent height, empty rows must be added:
<div ng-repeat="x in Array.from({length:itemsPerPage-itemsPerPage%availableRowsNumber})">
<tr></tr>
</div>