The below is the code in Angular 2. Could someone explain how to use ngclass in Stencil.js.
I have created the component is Angular2. Now trying to recreate the same in Stenciljs:
<div class="inner_holder" [ngClass]="isSelected(day)">
<div class="col day">{{day.month}}</div>
<div class="col date">
<span>{{day.date}}</span>
</div>
</div>
TypeScript Code:
isSelected(day) {
return (day.fullDay === this.selectedDay) ? "active" : "";
}
You can also use following syntax:
<div
class={{
'error': this.hasError,
'hidden': !this.isOpen
}}
>
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