I am trying to create a select element that has a list of numbers 1 to pages where pages is a variable that is the number of pages I have. What i don\'t know how to do is to
Piggybacking on martynas' answer. I modified it to include the last value in the range:
/*
* Creates a range
* Usage example:
*/
.filter('range', function () {
return function (input, start, end) {
var direction;
start = parseInt(start);
end = parseInt(end);
if (start === end) { return [start]; }
direction = (start <= end) ? 1 : -1;
while (start != end) {
input.push(start);
if (direction < 0 && start === end + 1) {
input.push(end);
}
if (direction > 0 && start === end - 1) {
input.push(end);
}
start += direction;
}
return input;
};
});