I'm looking to incorporate leaflet maps onto my page, under the following conditions:
If there is only one map, it should span the entire width using bootstrap grid columns. If there are two maps, they should be placed side by side with equal column widths (e.g., col-6). For three maps, two should be on the first row and one on the second row spanning the full width. And for five maps, they should be arranged in two rows with two maps in each row and one map in the third row, all stretching the entire width. (note: the number of elements varies dynamically from the backend)
.component.ts
for (var j = 0; j < this.sensorsarray.length; j++){
var v = "map" + i + "";
var div = document.createElement("div");
div.id = v;
div.style = "height:380px;";
console.log(v);
document.getElementById('mapper').appendChild(div);
// some code
}
.component.html
<div class="row no-gutters">
<div class="col-6" [ngClass]="{ 'col-12' : array.length %2 ==1 }">
<div id="mapper" style="height: 385px;border: 1px solid gray;"></div>
</div>
</div>
Can someone assist me with the above requirements?