问题描述
''我在我的 Angular 应用程序中使用 PrimeNg 的日历.我正在使用 multiple selectionMode 并将日历绑定到数据库中的日期数组.日历从数据库范围内的最新日期开始,但我希望它始终从今天的日期开始,然后用户可以前后导航以查看先前从数据库中选择的日期.我设置了 defaultDate 但它没有任何区别.
''I am using PrimeNg's calendar in my Angular Application. I am using multiple selectionMode and binding the calendar to an array of dates from the database. The calendar starts on the latest date in the range from the database but I want it to always start off with today's date and then the user can navigate backwards and forwards to see the previously selected dates from the database. I set the defaultDate but it doesn't make any difference.
请帮忙.
谢谢,
我的 html:
<p-calendar [(ngModel)]="myDates" selectionMode="multiple" [inline]="inline" selectOtherMonths="true" [defaultDate]="defaultDate"></p-calendar>
我的代码:
public myDates: Date[] = [];
public defaultDate: Date = new Date();
constructor()
{
this.myDates.push(new Date('01-01-2017'));
this.myDates.push(new Date('01-02-2017'));
this.myDates.push(new Date('01-07-2017'));
}
推荐答案
HTML
[minDate]=minDateValue"
HTML
[minDate]="minDateValue"
Ts
this.minDateValue = new Date();
Ts
this.minDateValue = new Date();
这篇关于如何始终在今天的日期打开 PrimeNg 的 p-calendar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!