2017-09-27 83 views
0

我想顯示隱藏類「有錯誤」由PrimeNg角2的<p-calendar>輸入布爾變量具有屬性inputStyleClassinputStyleClass PrimeNg角2

<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> 

我試圖設置inputStyleClass =「有錯誤: isHasError「與isHasError是正確的||假,但它不工作

回答

1

試試這個

<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> 
+0

這是工作。非常感謝! –