tabs: object = [
{ key: 'tab1', value: 'tab1' },
{ key: 'tab2', value: 'tab2' },
{ key: 'tab3', value: 'tab3' },
];
----------------------------
<div [ngSwitch]="my_tab">
<div *ngFor="let tab of tabs" *ngSwitchCase="'{{ tab.key }}'">
{{ tab.value }}
</div>
</div>
I always get an error.
Hello,
as far as I know, two structural directives are not possible on the same element.
You can use ng-container with ngif and div with ngswitch or reverse.
Best regards, anna-liebt
<div [ngSwitch]="my_tab">
<div *ngFor="let tab of tabs">
<ng-container *ngSwitchCase="tab.key">
{{ tab.value }}
</ng-container>
</div>
</div>
From stack overflow.