I am using *ngFor
and it has me perplexed. I am trying to use UIkit but it would be applicable to Bootstrap also.
<div *ngFor="let device of devices" >
<div class="uk-child-width-expand@s uk-text-center" uk-grid>
<div class="uk-card uk-card-secondary uk-card-hover uk-card-body uk-transform-origin-bottom-right uk-animation-scale-up">
<h2 class="uk-h2">{{ device.name }}</h2>
<button class="uk-button uk-button-default" (click)="toggleDevice(device)" ng-disabled="device.onStatus == true">On</button> <!-- In final app add: ng-disabled="!device.onStatus" -->
<button class="uk-button uk-button-default" (click)="toggleDevice(device)" ng-disabled="device.onStatus == false">Off</button> <!-- In final app add: ng-disabled="device.onStatus" -->
</div>
</div>
</div>
The element div class="uk-child-width-expand@s uk-text-center" uk-grid
needs be added at the start and after every 3rd element something like i % 3 === 0
is what I was thinking, just nothing I try will make it render correctly. Any ideas would be greatly received.
EDIT - I need to have the view rendered like the lower image on here rather than the top image
EDIT 2 - Added the demo to LINK As it loads is how it should look, working as only 3 elements. If you click sensors, this is how it is displayed using *ngIf tatements.