Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我喜欢为 p-calendar PrimeNG 组件设置默认日期,我该如何在 Angular 中做到这一点?
为此使用ngModel。
ngModel
<p-calendar [(ngModel)]="value"></p-calendar>
并设置您的具体value财产日期。例如,如果您想在今天前一个月设置一个日期:
value
this.value = new Date(); this.value.setMonth(this.value.getMonth() - 1);
见Plunker