Skip to content

bug(mat-slide-toggle): calling public method toggle does not trigger change event #33058

@jakobgruber

Description

@jakobgruber

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

Calling the public method toggle of the MatSlideToggle component does not trigger the change event.

Reproduction

StackBlitz link: https://stackblitz.com/edit/kgi2ifwx?file=src%2Fexample%2Fslide-toggle-overview-example.html,src%2Fexample%2Fslide-toggle-overview-example.ts&startScript=start
Steps to reproduce:

  1. click on mat-slide-toggle -> change event is triggered and a log message is rendered
  2. click on button which calls public method toggle -> no change event is triggered -> no log message is rendered

Expected Behavior

When I call the public method toggle I would expect, that not only the state is toggled but also the change event is triggered.

Actual Behavior

Only the state is toggled.

Environment

  • Angular:
  • CDK/Material:
  • Browser(s):
  • Operating System (e.g. Windows, macOS, Ubuntu):

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions