Skip to content

Commit

Permalink
fix(datepicker): makes sure the datepickerInput is registered (#7049)
Browse files Browse the repository at this point in the history
  • Loading branch information
roseperrone authored and mmalerba committed Sep 13, 2017
1 parent 259cc75 commit e4d48d7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/lib/datepicker/datepicker-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,22 @@ export class MdDatepickerInput<D> implements AfterContentInit, ControlValueAcces
/** The datepicker that this input is associated with. */
@Input()
set mdDatepicker(value: MdDatepicker<D>) {
this.registerDatepicker(value);
}
_datepicker: MdDatepicker<D>;

private registerDatepicker(value: MdDatepicker<D>) {
if (value) {
this._datepicker = value;
this._datepicker._registerInput(this);
}
}
_datepicker: MdDatepicker<D>;

@Input() set matDatepicker(value: MdDatepicker<D>) { this.mdDatepicker = value; }
@Input() set matDatepicker(value: MdDatepicker<D>) {
// Note that we don't set `this.mdDatepicker = value` here,
// because that line gets stripped by the JS compiler.
this.registerDatepicker(value);
}

@Input() set mdDatepickerFilter(filter: (date: D | null) => boolean) {
this._dateFilter = filter;
Expand Down

0 comments on commit e4d48d7

Please sign in to comment.