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(MatSlider): ERROR TypeError: Cannot read properties of undefined (reading '_hostElement') #29738

Closed
1 task
ice909 opened this issue Sep 15, 2024 · 3 comments · Fixed by #29745
Closed
1 task
Assignees
Labels
area: material/slider P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@ice909
Copy link

ice909 commented Sep 15, 2024

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

<mat-slider min="1" max="5" step="0.5" value="1.5"></mat-slider>

Using this MatSlider component will print the following error in the console
image

Reproduction

StackBlitz link: https://material-14.angular.cn/guide/getting-started
Steps to reproduce:

  1. Following the official example, the console reports this error after MatSlider is displayed on the page

Expected Behavior

No error

Actual Behavior

error

Environment

  • Angular: 18.2.4
  • CDK/Material: 18.2.4
  • Browser(s): Chrome 128.0.6613.84
  • Operating System (e.g. Windows, macOS, Ubuntu): Linux Deepin v23
@ice909 ice909 added the needs triage This issue needs to be triaged by the team label Sep 15, 2024
crisbeto added a commit to crisbeto/material2 that referenced this issue Sep 17, 2024
…orrectly

Fixes that we were throwing a cryptic error if the slider isn't set up properly.

Fixes angular#29738.
@crisbeto
Copy link
Member

You're looking at the docs for a much older version than the one you're running. The correct docs are at https://material.angular.io/components/slider/overview. That being said, the error message we log can be improved. I've sent a fix for the error message at #29745.

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: material/slider and removed needs triage This issue needs to be triaged by the team labels Sep 17, 2024
@crisbeto crisbeto self-assigned this Sep 17, 2024
@ice909
Copy link
Author

ice909 commented Sep 17, 2024

You're looking at the docs for a much older version than the one you're running. The correct docs are at https://material.angular.io/components/slider/overview. That being said, the error message we log can be improved. I've sent a fix for the error message at #29745.

Thank you!

crisbeto added a commit that referenced this issue Sep 18, 2024
…orrectly (#29745)

Fixes that we were throwing a cryptic error if the slider isn't set up properly.

Fixes #29738.
crisbeto added a commit that referenced this issue Sep 18, 2024
…orrectly (#29745)

Fixes that we were throwing a cryptic error if the slider isn't set up properly.

Fixes #29738.

(cherry picked from commit 0ed5d7d)
@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 Oct 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/slider 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.

2 participants