使用 PrimeNG 日历在数据库中输入数据

Using the PrimeNG Calendar to input data in a database

我正在尝试用 PrimeNG 日历替换文本框,但保留它存储将保存在数据库中的值的功能。

我认为也许可以将输入和 p-calendar 相结合:

<p-calendar #CreateDate [(ngModel)]="CreateDates" [value]="{{CreateDates}}" [showIcon]="true" dateFormat="dd.mm.yy"></p-calendar>

但这显然是行不通的,会导致很多错误。

我得到的异常:

Parser Error: Got interpolation ({{}}) where expression was expected

以及以下错误:

使用 Angular2 指令时,您不必使用插值语法来访问值。此外,因为您双向绑定到变量 CreateDates,只要它是有效日期,它就会自动将值添加到您的日历中。确保 CreateDates 中的值是有效日期并执行此操作

<p-calendar #CreateDate [(ngModel)]="CreateDates" 
[showIcon]="true" dateFormat="dd.mm.yy"></p-calendar>