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

bug(timepicker): cannot disable timepicker from template #30061

Closed
f-mon opened this issue Nov 21, 2024 · 1 comment · Fixed by #30063
Closed

bug(timepicker): cannot disable timepicker from template #30061

f-mon opened this issue Nov 21, 2024 · 1 comment · Fixed by #30063
Assignees
Labels
area: material/timepicker P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@f-mon
Copy link

f-mon commented Nov 21, 2024

Description

The disable input in timepicker.ts component is protected so angular compiler reports an error if you try to diable it from template:

<mat-form-field>
  <mat-label>Pick a time</mat-label>
  <input matInput [matTimepicker]="picker" disabled >
  <mat-timepicker-toggle matIconSuffix [for]="picker"/>
  <mat-timepicker #picker/>
</mat-form-field>

compiling will report:


Error: src/example/timepicker-overview-example.html:4:44 - error TS2445: Property 'disabledInput' is protected and only accessible within class 'MatTimepickerInput<D>' and its subclasses.

4   <input matInput [matTimepicker]="picker" disabled >
                                             ~~~~~~~~

  src/example/timepicker-overview-example.ts:10:16
    10   templateUrl: 'timepicker-overview-example.html',
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reproduction

StackBlitz link: https://stackblitz.com/edit/tn1pxy?file=src%2Fexample%2Ftimepicker-overview-example.html

Expected Behavior

should be possible to disable the timepicker field from template

Actual Behavior

it reports a compiling error

Environment

  • Angular: 19
  • CDK/Material: 19
@f-mon f-mon added the needs triage This issue needs to be triaged by the team label Nov 21, 2024
@crisbeto crisbeto self-assigned this Nov 21, 2024
@shiv-2810
Copy link

Can i work on this bug?

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: material/timepicker and removed needs triage This issue needs to be triaged by the team labels Nov 22, 2024
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 22, 2024
Initially the `disabled` input was marked as `protected`, because the actual disabled state is a `computed`. This seems to break with some compiler options so these changes switches it to be public.

Fixes angular#30061.
crisbeto added a commit that referenced this issue Nov 22, 2024
Initially the `disabled` input was marked as `protected`, because the actual disabled state is a `computed`. This seems to break with some compiler options so these changes switches it to be public.

Fixes #30061.

(cherry picked from commit d6b3775)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: material/timepicker P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants