Hi Rajapandiyan,
Sorry for the misunderstanding if there is one but we have to make conditons on <e-column> tag or upper and not inside the <ng-template> one.
This example doesn't mean anything but here is how we would like to separate our dynamic columns (based on your stackblitz example)
<ejs-grid #grid [dataSource]='data'>
<e-columns>
<ng-container *ngFor="let column of columns; let indexOfelement = index">
<ng-container [ngSwitch]="index">
<e-column *ngSwitchCase="1" [field]="column.field" [width]="column.width">
<ng-template #template let-data>
<span style="color:red"> {{data[column.field]}}</span>
</ng-template>
</e-column>
<e-column *ngSwitchCase="2" [field]="column.field" [width]="column.width">
<ng-template #template let-data>
<span style="color:blue"> {{data[column.field]}}</span>
</ng-template>
</e-column>
<e-column *ngSwitchDefault [field]="column.field" [width]="column.width">
<ng-template #template let-data>
<span style="color:green">{{data[column.field]}}</span>
</ng-template>
</e-column>
</ng-container>
</ng-container>
</e-columns>
</ejs-grid>
Because some of the columns are normal and other require specific attributes on the <e-column> tag and specific <ng-template> too.
The code doesn't display the grid. Only an error "Error: Cannot read property 'directivePropList' of undefined" in the console.
Regards