Below is my partial angular2 component template html. "searchTickets$" is an Observable of array of objects.
<table class="table table-condensed" *ngIf="searchTickets$">
<thead>
<tr>
<th><h3>Ticket ID</h3></th>
</tr>
</thead>
<tbody>
<tr *ngFor="let ticket of searchTickets$ | async">
<td><small>{{ticket.ticketID}}</small></td>
</tr>
</tbody>
</table>
My intention is that the table should be displayed only when the observable returns 1 or more records.
What needs to be modfied in *ngIf condition to make that happen.
You should try
<table class="table table-condensed" *ngIf="(searchTickets$ | async)?.length > 0">
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments