Just curious if there are any bigger advantages on any of these approaches?
<div class="small" ngClass="well-{{small}}">small</div>
or
<div class="small" class="well-{{big}}">big</div>
The way you are using ngClass it does not matter. Although, ngClass allows us to conditionally add classes, i.e.
<some-element [ngClass]="{'first': true, 'second': true, 'third': false}">...</some-element>
when using class, you will have something like:
<some-element [class]="someExpression ? 'first' : ''">...</some-element>
To sum it up, ngClass is more flexible when you have to add conditional classes.
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