here is my html:
<ng-container *ngIf="col.data !== ''">
<ng-template [ngSwitch]="col.data">
<ng-container *ngSwitchCase="'Page'">
<div>{{getData(data, col.data, col.dataName)}}</div>
</ng-container>
<ng-container *ngSwitchDefault>
{{getData(data, col.data, col.dataName)}}
</ng-container>
</ng-template>
</ng-container>
when i implement the switchCase using above, getting an error as:
No provider for NgSwitch ("<ng-template [ngSwitch]="col.data">
[ERROR ->]<ng-container *ngSwitchCase="'Page'">
like above. until i use the ngswich it was worked well. I have already imported common module too..
any one help me to sort this issue?
You cannot use [ngSwitch]
on <ng-template>
. You can either use it on HTML elements, or <ng-container>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With