Fill an option tag with a for

0

I want to make a select that has a option tag which is filled with values from 1 to 8

<select class="num_per" [(ngModel)]="personas" [ngModelOptions]="{standalone: true}" name="personas">
   <option class="placeholder" [value]="valor" class="tagHidden" disabled>Personas</option>
   <option value="2" ></option>
   <option value="Solicitud de cotización">8 + Solicita cotización aquí 
   </option>
</select>

In the first label option is the one that I want to fill with values from 1 to 8, these values from 1 to 8 can come from an array or in any way since I use angular to create the web pages.

Thanks for reading.

Greetings

    
asked by Gerardo Gutiérrez 23.08.2018 в 18:12
source

1 answer

1

You can try something like this.

<select class="num_per" [(ngModel)]="personas" [ngModelOptions]="{standalone: true}" name="personas">

    <option value="{{i}}" *ngFor="let i of [1,2,3,4,5,6,7,8]">{{i}}</option>

</select>
    
answered by 23.08.2018 в 19:00