Skip to content

bug(mat-slider): Experimental mat-slider throws Cannot read properties of undefined (reading '_hostElement') #24057

@adrian-heath

Description

@adrian-heath

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

When adding the most basic experimental mat-slider to a page it throws the error

TypeError: Cannot read properties of undefined (reading '_hostElement')

when initializing the page. This does not happen with other experimental controls or the normal mat-slider. The page does not use a form.

Reproduction

Steps to reproduce:

  1. Create a page with routing (in my case it is lazy-loaded but I don't think this matters)
  2. craete a containing a
  3. Navigate to the page and an alert is show with the above message

Expected Behavior

the experimental mat-slider works as expected

Actual Behavior

Error thrown and the slider renders as a solid bar

Environment

  • Angular: 13.0.2 (also 12.x)
  • CDK/Material: Experimental 13.0.2
  • Browser(s): Chrome 96
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/slider

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions