mercredi 21 décembre 2016

Angular2 else statement

How does angular2 propose to render

<div *ngFor="let todo of unfinishedTodos">
    
</div>

in case if unfinishedTodos.length >0

and text "empty" in another cases.

P.S.

<div *ngIf="unfinishedTodos && unfinishedTodos.length > 0">
    <div *ngFor="let todo of unfinishedTodos">
        
    </div>
</div>
<div *ngIf="!unfinishedTodos ||  unfinishedTodos.length <= 0">
    empty
</div>

looks ugly

Aucun commentaire:

Enregistrer un commentaire