0

I want to display this form within two columns. The elements with index from 0 to 4 wrapped in a 'col-md-6' class and from index 5 to 8 in a new 'col-md-6'. Can I achieve that?

 <form [formGroup]="openingHoursForm">
   <div *ngFor="let dia of selectedCenter.dias; let i = index">
     <div class="dayOpeningHours" itemprop="openingHours" title="">
       <div>{{ i }}</div>
         <div class="opens">
           <label for="">De:
             <input class="form-control" id="mondayFrom" type="time" formControlName="openingTime{{ dia.diasemana }}" name="openingTime{{ dia.diasemana }}" value="{{ dia.horainicio }}">
           </label>
         </div>
         <div class="closes">
           <label for="">A:
             <input class="form-control" id="mondayTo" type="time" formControlName="closingTime{{ dia.diasemana }}" name="closingTime{{ dia.diasemana }}" value="{{ dia.horafinal }}">
           </label>
         </div>
       </div>
     </div>
  </form>

1 Answer 1

2

Use the slice pipe With the SlicePipe https://angular.io/api/common/SlicePipe

<div class="col-md-6">
  <div *ngFor="let dia of selectedCenter.dias | slice:0:5>
    ...
  </div>
</div>
<div class="col-md-6">
  <div *ngFor="let dia of selectedCenter.dias | slice:5:9>
    ...
  </div>
</div>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.