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

help(MatDatePicker): Ability to Conditionally Show/Hide mat-datepicker-actions #25122

Closed
penrodlol opened this issue Jun 20, 2022 · 1 comment · Fixed by #25123
Closed

help(MatDatePicker): Ability to Conditionally Show/Hide mat-datepicker-actions #25122

penrodlol opened this issue Jun 20, 2022 · 1 comment · Fixed by #25123
Assignees
Labels
area: material/datepicker P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@penrodlol
Copy link

What are you trying to do?

When creating a mat-datepicker component we have the following example:

<mat-datepicker #picker>
  <mat-datepicker-actions *ngIf="prop$ | async">
     ...
  </mat-datepicker-actions>
</mat-datepicker>

Within this datepicker's header, there's a mat-slide-toggle that updates the props$ state to T/F. However, when updated, the mat-datepicker-actions remain visible within the template...

Is there a way to ensure the actions can be shown/removed without having to close and repoen the datepicker popover?

What troubleshooting steps have you tried?

  1. Force change detection via ChangeDetectorRef.
  2. Utilize the registerActions and removeActions methods on MatDatepicker.

Reproduction

https://stackblitz.com/edit/components-issue-xiz8hd?file=src/app/example-component.ts

Environment

  • Angular: 13
  • CDK/Material: 13
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows
@penrodlol penrodlol added needs triage This issue needs to be triaged by the team troubleshooting This issue is not reporting an issue, but just asking for help labels Jun 20, 2022
@crisbeto crisbeto self-assigned this Jun 21, 2022
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent has pr area: material/datepicker and removed troubleshooting This issue is not reporting an issue, but just asking for help needs triage This issue needs to be triaged by the team labels Jun 21, 2022
crisbeto added a commit to crisbeto/material2 that referenced this issue Jun 21, 2022
…le calendar is open

Fixes that we were only refreshing the actions while the calendar is closed.

Fixes angular#25122.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jun 21, 2022
…le calendar is open

Fixes that we were only refreshing the actions while the calendar is closed.

Fixes angular#25122.
crisbeto added a commit that referenced this issue Jun 22, 2022
…le calendar is open (#25123)

Fixes that we were only refreshing the actions while the calendar is closed.

Fixes #25122.

(cherry picked from commit 7d87068)
crisbeto added a commit that referenced this issue Jun 22, 2022
…le calendar is open (#25123)

Fixes that we were only refreshing the actions while the calendar is closed.

Fixes #25122.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/datepicker P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
2 participants