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

fix(datepicker): add coercion for opened input #20250

Merged
merged 1 commit into from
Aug 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/material/datepicker/datepicker-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,9 @@ export abstract class MatDatepickerBase<C extends MatDatepickerControl<D>, S,
/** Whether the calendar is open. */
@Input()
get opened(): boolean { return this._opened; }
set opened(value: boolean) { value ? this.open() : this.close(); }
set opened(value: boolean) {
coerceBooleanProperty(value) ? this.open() : this.close();
}
private _opened = false;

/** The id for the datepicker calendar. */
Expand Down Expand Up @@ -642,5 +644,6 @@ export abstract class MatDatepickerBase<C extends MatDatepickerControl<D>, S,
}

static ngAcceptInputType_disabled: BooleanInput;
static ngAcceptInputType_opened: BooleanInput;
static ngAcceptInputType_touchUi: BooleanInput;
}