Answers for "angular can't have multiple template bindings"

0

angular can't have multiple template bindings

Can't use two template binding on one element in Angular 2 (like *ngIf and *ngFor). But you can achieve the same by wrapping the element with a span or any other element. It is good to append with an <ng-container> as it is a logical container and it will not get append to the DOM. For example,

<ng-container *ngIf="condition">
    <li *ngFor="let item of items">
        {{item}}
    </li>
</ng-container>
Posted by: Guest on March-31-2022

Code answers related to "TypeScript"

Browse Popular Code Answers by Language