Skip to content

slide toggle programatic changing of checked value is not working #11563

Open
@alexw10

Description

@alexw10

Bug, feature request, or proposal:

I believe I found a bug where when changing the [checked] value is not working.

What is the expected behavior?

Changing the [checked] value should propagate through the component.

What is the current behavior?

When changing the [checked] value inside of the (change) output it does not get updated throughout the slide-toggle component.

What are the steps to reproduce?

Providing a StackBlitz reproduction is the best way to share your issue.

StackBlitz starter: https://goo.gl/wwnhMV

See:
https://stackblitz.com/edit/angular-auatm8?file=app%2Fslide-toggle-configurable-example.ts

Take a look at the console.log when clicking the slide-toggle component:

#change ngOnInit false
Angular is running in the development mode. Call enableProdMode() to enable the production mode.
#change initial: false true true
expecting the slide toggle to be toggled-off (false), but it sets to toggled-on (true)
#change final: false true true

What is the use-case or motivation for changing an existing behavior?

Want users to be able to confirm the change/negate it.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

See the stackblitz

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: material/slide-toggle

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions