Skip to content

Commit

Permalink
Calendar fix for OnPush change detection strategy
Browse files Browse the repository at this point in the history
Added trigger for change detection in the body click handler. Fix for primefaces#2148.
  • Loading branch information
external-olgierd authored Feb 24, 2017
1 parent ceff085 commit a97a4c3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions components/calendar/calendar.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,OnInit,Input,Output,SimpleChange,EventEmitter,forwardRef,Renderer,trigger,state,style,transition,animate,ViewChild} from '@angular/core';
import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,OnInit,Input,Output,SimpleChange,EventEmitter,forwardRef,Renderer,trigger,state,style,transition,animate,ViewChild,ChangeDetectorRef} from '@angular/core';
import {CommonModule} from '@angular/common';
import {ButtonModule} from '../button/button';
import {InputTextModule} from '../inputtext/inputtext';
Expand Down Expand Up @@ -304,7 +304,7 @@ export class Calendar implements AfterViewInit,OnInit,OnDestroy,ControlValueAcce
this.createMonth(this.currentMonth, this.currentYear);
}

constructor(public el: ElementRef, public domHandler: DomHandler,public renderer: Renderer) {}
constructor(public el: ElementRef, public domHandler: DomHandler,public renderer: Renderer, private cd: ChangeDetectorRef) {}

ngOnInit() {
let date = this.defaultDate||new Date();
Expand Down Expand Up @@ -1166,6 +1166,7 @@ export class Calendar implements AfterViewInit,OnInit,OnDestroy,ControlValueAcce

this.closeOverlay = true;
this.dateClick = false;
this.cd.detectChanges();
});
}
}
Expand Down Expand Up @@ -1198,4 +1199,4 @@ export class Calendar implements AfterViewInit,OnInit,OnDestroy,ControlValueAcce
exports: [Calendar,ButtonModule,InputTextModule],
declarations: [Calendar]
})
export class CalendarModule { }
export class CalendarModule { }

0 comments on commit a97a4c3

Please sign in to comment.