Structural Directives
- *ngIf
- *ngFor
- [ngSwitch]
*ngIf
If logic
<table class='table' *ngIf='items && items.length'> </table>
items are not null and items are more than 1 item
*ngFor
For loop
<tr *ngFor='let item of items'> <td></td> <td>{{ item.name }}</td> <td>{{ item.price }}</td> </tr>
コメント