Michael Seery

Michael Seery

  • NA
  • 85
  • 10.4k

ngFor Loop - Display over 2 Bootstrap columns

Aug 4 2020 5:58 PM
I have an ngFor that loops over a list of roles that displays check boxes in a list in one column.
 
What I want to do is display this list over 2 columns.
 
I have the following code that prduces the single column list.
  1. class="form-check" *ngFor="let role of roles">  
  2.       class="row">  
  3.         class="col-6">  
  4.           
  5.             class="form-check-input"  
  6.             type="checkbox"  
  7.             value="role.name"  
  8.             [checked]="role.checked"  
  9.             (change)="role.checked = !role.checked && (supplier = true)"  
  10.             [disabled]="  
  11.               role.name === 'Administrator' && user.userName === 'Admin'"  
  12.           />  
  13.             
  14.         
     
I tried removing the row div in the hope that the div with col-6 would place them side by side and then wrap to a new line but it didn't work.
 
Any help would be very much appreciated. 
 

Answers (3)