Create select with values 1 to x using a variable


#1

Hi,

Is there an easy way to create a dropdown select that will dynamically build options from 1 to {{seatsAvailable}} where seats available could be any number?


#2

Hi,
Have you tried with:
http://ionicframework.com/docs/api/service/$ionicPopover/ ?


#3

Hi,

I had a look at the ionicPopover and it’s not quite right for the scenario I have. I just need to be able to populate a select as per below where the number of options is based on a variable in my scope

<select name="seatsRequired">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
.... keep looping through options until {{seatsAvailable}} is reached
</select>

#4

Since you are using the {{seatsAvailable}}, I suggest you create a filter, something like this.

https://jsfiddle.net/88qaLgy4/