Skip to content

Commit e4d48d7

Browse files
roseperronemmalerba
authored andcommitted
fix(datepicker): makes sure the datepickerInput is registered (#7049)
1 parent 259cc75 commit e4d48d7

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/lib/datepicker/datepicker-input.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,22 @@ export class MdDatepickerInput<D> implements AfterContentInit, ControlValueAcces
9090
/** The datepicker that this input is associated with. */
9191
@Input()
9292
set mdDatepicker(value: MdDatepicker<D>) {
93+
this.registerDatepicker(value);
94+
}
95+
_datepicker: MdDatepicker<D>;
96+
97+
private registerDatepicker(value: MdDatepicker<D>) {
9398
if (value) {
9499
this._datepicker = value;
95100
this._datepicker._registerInput(this);
96101
}
97102
}
98-
_datepicker: MdDatepicker<D>;
99103

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

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

0 commit comments

Comments
 (0)