0

I want show hide class "has-error" by boolean variable for input of <p-calendar> on PrimeNg Angular 2 with properties inputStyleClass

<p-calendar [(ngModel)]="fromDate" [showIcon]="true" dateFormat="mm/dd/yy" styleClass="datepicker" inputStyleClass="has-error" pTooltip = "From Date less than To Date" tooltipPosition="top" [tooltipDisabled]="isValidFromDate" (keydown)="keydownSearch($event)"></p-calendar>

I tried set inputStyleClass="has-error: isHasError" with isHasError is true || false but it isn't working

Nobita
  • 330
  • 1
  • 11

1 Answers1

1

Try this

<p-calendar [(ngModel)]="fromDate" [showIcon]="true" dateFormat="mm/dd/yy" styleClass="datepicker" inputStyleClass="(validate == false) ? 'has-error' : ''" pTooltip = "From Date less than To Date" tooltipPosition="top" [tooltipDisabled]="isValidFromDate" (keydown)="keydownSearch($event)"></p-calendar>
Double H
  • 4,120
  • 1
  • 15
  • 26