+ Start a Discussion
Cody Drennon 6Cody Drennon 6 

Angular I am trying to use a *ngIf statement inside an ngFor statment and am using it to determine the id in which to use based on the parameters

I am trying to use a *ngIf statement inside an ngFor statment and am using it to determine the id in which to use based on the parameters.

I am trying to use id='floatLeft' if the ngIf statement "tran.type==='checkIn' and trying to use id=floatRight if "tran.type='checkOut'".  I cant seem to make this work though.  Please see code below.  Any help would be greatly appciated.

<ng-container>
<md-list-item *ngFor="let tran of transactions">
<div *ngIf="tran.type === 'checkIn'" class="w3-card-4 w3-dark-grey" id="floatLeft">
<div *ngIf="tran.type === 'checkOut'" class="w3-card-4 w3-dark-grey" id="floatRight">
<div class="w3-container w3-center">
<h3>Past Check In</h3>
{{tran.hours}} : {{tran.minutes}} {{tran.amPm}} <br>
<button class="w3-button w3-green">Edit</button>
<button class="w3-button w3-red">Cancel</button>
</div>
</div>
</md-list-item>
</ng-container>