p-calendar input doesn't update

UI Components for Angular
Post Reply
robyrobert42
Posts: 2
Joined: 18 Jan 2018, 09:15

18 Jan 2018, 09:34

Hi everyone, I implemented <p-calendar [(ngModel)]="selectedDate" showIcon="true" (onSelect)="method()"></p-calendar>. I have also a method wich set "selecteddate " setPreviousDay(): void {
this.selectedDate.setDate(this.selectedDate.getDate() - 1); to previousDay. Everything is working fine, just that the inputfield from p-calendar does not update. Is there a solution? Thanks

robyrobert42
Posts: 2
Joined: 18 Jan 2018, 09:15

18 Jan 2018, 18:48

Hi, if somebody will look at this, I wannt to share what I did to update the inputfield when setNext or Previous day.
I looked for method witch updates the inputField in calendar.d.js. ( updateInputfield(): void;) and every time I press the button for prev or next I call this method. this.myCalendar.updateInputfield();
// that's in .ts
@ViewChild('myCalendar')
private myCalendar: any;
//html
<p-calendar [(ngModel)]="selectedDate"
showIcon="true"
(onSelect)="getActivityByDateAndShortcut()"
#myCalendar></p-calendar>

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 8 guests