我正在使用Primeng日历选择多个日期,然后使用[(ngmodel)]将组件绑定到一个日期数组。当我选择一个日期时,它会自动推到数组,但是当我取消选择日期时,它总是在那里。
这是日历模板:
<p-calendar name="DupDates" [(ngModel)]="DupDates" [dateFormat]="dateFormat"
[monthNavigator]="monthNavigator"
[locale]="calendarFr" [readonlyInput]="true" [inline]="true"
[maxDateCount]="4" [selectionMode]="multiple">
</p-calendar>
从 selectionMode
删除方括号。
用selectionMode="multiple"
替换[selectionMode]="multiple"
。
所以显然它是p-calendar中的一个错误,我没有找到任何hack修复它,我只是删除了多个选择,并使用 onSelect
event添加了日期。
这是问题的链接:https://github.com/primefaces/primeng/issues/3876