Edit: After more thoughts, i am removing the unnecessary element within the TS file and making my template file do less work.
I've looked at a few stack o/f threads about removing a div and the white space that it takes. Such as this one
The div is hidden, however the white space is still there on my template.
code
<div *ngIf="array[i] !== null; else hideDivAndRemoveWhiteSpace">
  //business logic
</div>
<ng-template #hideDivAndRemoveWhiteSpace>
  //this template should be hidden
  <div class="hide-div"></div>
</ng-template>
css
.hide-div {
  display: none;
}
 
     
     
    