From e4d48d709ac82f8eb91e43724a35d2abe142a1ac Mon Sep 17 00:00:00 2001 From: Rose Perrone Date: Wed, 13 Sep 2017 09:31:30 -0700 Subject: [PATCH] fix(datepicker): makes sure the datepickerInput is registered (#7049) --- src/lib/datepicker/datepicker-input.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/datepicker/datepicker-input.ts b/src/lib/datepicker/datepicker-input.ts index aa09ae366812..f44fac9d8f90 100644 --- a/src/lib/datepicker/datepicker-input.ts +++ b/src/lib/datepicker/datepicker-input.ts @@ -90,14 +90,22 @@ export class MdDatepickerInput implements AfterContentInit, ControlValueAcces /** The datepicker that this input is associated with. */ @Input() set mdDatepicker(value: MdDatepicker) { + this.registerDatepicker(value); + } + _datepicker: MdDatepicker; + + private registerDatepicker(value: MdDatepicker) { if (value) { this._datepicker = value; this._datepicker._registerInput(this); } } - _datepicker: MdDatepicker; - @Input() set matDatepicker(value: MdDatepicker) { this.mdDatepicker = value; } + @Input() set matDatepicker(value: MdDatepicker) { + // 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;