깜놀하는 해므찌로

Can't have multiple template bindings on one element. Use only one attribute prefixed with 에러 해결 본문

IT

Can't have multiple template bindings on one element. Use only one attribute prefixed with 에러 해결

agnusdei1207 2023. 6. 5. 11:27
반응형
SMALL
<div>
    <a *ngFor="let menu of menus" [routerLink]="menu.path" class="flex flex-col" (click)="handleMenuClick(menu)">
        {{ menu.name }}
        <ng-container *ngIf="menu.children && (currentPath == menu.path)">
            <a *ngFor="let item of children">
                {{ item.name }}
            </a>
        </ng-container>
    </a>
</div>

1. 태그 안에 *ngIf 와 *ngFor 같이 사용해서 발생

2. ng-container 를 활용하여 해결

반응형
LIST