I am facing an issue with my code where I have two lists that are displayed in my .html file. In order to avoid repetition, I decided to utilize ngSwitch. However, when I try to implement this approach, I encounter an error. Here is the snippet of code causing the problem:
<div [ngSwitch]="currentListView">
<div *ngSwitchCase="'People'">
<div dnd-sortable-container [dropZones]="['zone-one']" [sortableData]="listOfPeople">
<div class="list-bg" *ngFor="#person of listOfPeople; #i = index" dnd-sortable [sortableIndex]="i">
ID: {{bulk.person}} <p></p> Name: {{person.name}}
</div>
</div>
</div>
<div *ngSwitchCase="'Cars'">
<div dnd-sortable-container [dropZones]="['zone-one']" [sortableData]="listOfCars">
<div class="list-bg" *ngFor="#car of listOfCars; #i = index" dnd-sortable [sortableIndex]="i">
ID: {{car.id}} <p></p> Color: {{car.color}}
</div>
</div>
</div>
Concerning the mentioned error for each list, it states:
(in promise): Template parse errors: Can't bind to 'ngSwitchCase' since it isn't a known native property ("
<div [ngSwitch]="currentListView"> <div [ERROR ->]*ngSwitchCase="'People'"> <div dnd-sortable-container [dropZones]="['zone-one']" [sortableData"): AppCmp@42:9 Property binding ngSwitchCase not used by any directive on an embedded template (" <div [ngSwitch]="currentListView"> [ERROR -><div *ngSwitchCase="'People'"> <div dnd-sortable-container [dropZones]="['zone-one']" [sortabl"): AppCmp@42:4 Can't bind to 'ngSwitchCase' since it isn't a known native property (" </div> </div>
I am seeking assistance to troubleshoot this issue and also improve the efficiency of my code.
Thank you.