Quantcast
Channel: Angular: conditional class with *ngClass - Stack Overflow
Viewing all articles
Browse latest Browse all 26

Answer by Priyanka Ahire for Angular: conditional class with *ngClass

$
0
0

If user want to display the class on basis of && and ||then below one is work for me

[ngClass]="{'clasname_1':  condition_1 && condition_2, 'classname_2':  condition_1 && condition2, 'classname_3': condition}"

Example:

[ngClass]="{'approval-panel-mat-drawer-side-left':  similar_toil_mode==='side'&& showsTheSimilarToilsWithCloseIcon, 'approval-panel-mat-drawer-side-right':  similar_toil_mode==='side'&& !showsTheSimilarToilsWithCloseIcon, 'approval-panel-mat-drawer-over': similar_toil_mode==='over'}"

Viewing all articles
Browse latest Browse all 26

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>