Reputation: 5101
I am applying the class name as follows:
<tr *ngIf="crud.isCreate" [ngClass]="{'create' : curd?.isCreate}">
but I am not class name added with it. in html it shows like:
<tr _ngcontent-yql-c9="" ng-reflect-ng-class="[object Object]">
- what is wrong here?
*ngIf="crud.isCreate"
- condition works properly.
any one help me to understand?
Upvotes: 1
Views: 3111
Reputation: 2327
you can try like this. I'm considering no typo in your code.
<tr *ngIf="crud.isCreate" [ngClass]="curd?.isCreate ? 'create' : ''">
I hope it helps you out
Upvotes: 0
Reputation: 1839
You have a typo there. curd
should be crud
<tr *ngIf="crud.isCreate" [ngClass]="{'create' : crud?.isCreate}">
Upvotes: 3