If you are looking to achieve a specific layout, simply include an additional class within the div
being looped through using *ngFor
, like so:
<div
*ngFor="let item of itemsArray"
[ngClass]="{ 'custom-class': item.type !== 'description' }"
>
You can then utilize this class to style the element with an inline-block display property to prevent it from wrapping to the next line, such as:
.custom-class {
display: inline-block;
width: 50%;
}
(Additionally, specifying a width may be necessary based on your design requirements)
Here is how it will appear:
https://i.stack.imgur.com/k3aoY.png
To see this in action, check out the modified version of your stackblitz demo here:
https://stackblitz.com/edit/typeinformationdynamic-i24na7?file=app/dynamic-form.component.ts