我正在尝试在 ngForm 中使用 PrimeNG datepicker 并应用所需的验证。
<p-calendar formControlName="eventStartDate"
inputStyleClass="form-control"
#eventStartDate="ngModel"
ngControl="eventStartDate"
id="eventStartDate"
[(ngModel)]="event.eventStartDate"
minDate="+1d"
[showIcon]="true"
required>
</p-calendar>
<span [hidden]="eventStartDate.valid || eventStartDate.pristine"
class="help-block">
Start Date is required !
</span>
但是,我遇到了一个例外,
Template parse errors:
There is no directive with "exportAs" set to "ngModel" ("
<div class="input-group form-inline">
<p-calendar [ERROR ->]#eventStartDate="ngModel"
name="eventStartDate"
formControlName="eventStartDate"
inputStyleClass="f").
我们应该如何将 PrimeNG 控件添加到角度形式?