Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ngOnChanges hooks. #543

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions components/datepicker/datepicker-inner.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, OnInit, EventEmitter, Input} from '@angular/core';
import {Component, OnInit, EventEmitter, Input, OnChanges} from '@angular/core';
import {
CORE_DIRECTIVES, FORM_DIRECTIVES, NgClass, NgModel
} from '@angular/common';
Expand Down Expand Up @@ -48,7 +48,7 @@ const SHORTCUT_PROPAGATION = false;
`,
directives: [FORM_DIRECTIVES, CORE_DIRECTIVES, NgClass, NgModel]
})
export class DatePickerInnerComponent implements OnInit {
export class DatePickerInnerComponent implements OnInit, OnChanges {
@Input() public datepickerMode:string;
@Input() public startingDay:number;
@Input() public yearRange:number;
Expand Down Expand Up @@ -97,7 +97,6 @@ export class DatePickerInnerComponent implements OnInit {

public set activeDate(value:Date) {
this._activeDate = value;
this.refreshView();
}

// todo: add formatter value to Date object
Expand Down Expand Up @@ -131,7 +130,10 @@ export class DatePickerInnerComponent implements OnInit {
} else if (this.activeDate === undefined) {
this.activeDate = new Date();
}
}

// this.refreshView should be called here to reflect the changes on the fly
public ngOnChanges():void {
this.refreshView();
}

Expand Down