Angular do ngIf twice without adding new element

 Since in angular it is impossible to put two *ngIf directives in the same element, the workaround is to do it by using ng-container, like this:

<ng-container *ngIf="...">
    <ng-container *ngIf="...">
    </ng-container>
</ng-container>


This does not add any elements to the rendered HTML.


Post a Comment

Previous Post Next Post