May 10, 2020
Estimated Post Reading Time ~

Angular 2: Structural Directives

So there are a few directives that I would like to discuss.

*ngIf and *ngFor
*ngIf – if the expression is evaluated as a true or false value

<table class='table' *ngIf='clients && clients.length'>
If the data is absent then nothing will be displayed.

*ngFor – use to repeat an element and its children in the dom for each element in the iterable list.

<tr *ngFor='#client of clients'>
<td>{{ client.clientName}}</td>
<td>{{ client.clientLastName}}</td>
<td>{{ client.zip}}</td>
</tr>


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.