Use case - Sometimes , there occurs a need where in we need to use two structural directives simultaneously. We need to hide and show a grid and within the grid we want to iterate over the list.
Alert Point!!!!!.....We can’t use two structural directives in the same DOM element.
Solution :
Not so elegant solution – Use two different HTML tag , one with ngIf and other with ngFor. Unnecessary Dom addition , which can affect the layout.
Elegant Solution – use ng-container
No comments:
Post a Comment