Components: docs: simple example for slide-toggle with ngModel

Created on 17 Feb 2017  路  5Comments  路  Source: angular/components

Bug, feature request, or proposal:

What is the expected behavior?

What is the current behavior?

What are the steps to reproduce?

Providing a Plunker (or similar) is the best way to get the team to see your issue.
Plunker template: http://plnkr.co/edit/o077B6uEiiIgkC0S06dd

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

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

Is there anything else we should know?

docs has pr

Most helpful comment

@pdavin That's true. It's very unlikely that some just uses the [checked] input binding.

Maybe we should also have a second demo that is very simple and shows the usage with an NgModel.

All 5 comments

Moving the toggle doesn't change the actual model property.
It's represented on the examples tab of this page https://material.angular.io/components/component/slide-toggle
If [(ngModel)] works well for this control, why [checked] is created?

The [checked] input is a one-way data binding and can be used without the FormsModule.

It exists for convenience and to be aligned with the native input elements.

This is very confusing and I think at least the docs should be updated. The example / demo shows an md-slide-toggle with a checked property and no ngModel. I think it's very uncommon that anyone will want a slide toggle that does input but not output.

https://material.angular.io/components/component/slide-toggle
class="example-margin"
[color]="color"
[checked]="checked"
[disabled]="disabled">
Slide me!

@pdavin That's true. It's very unlikely that some just uses the [checked] input binding.

Maybe we should also have a second demo that is very simple and shows the usage with an NgModel.

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Miiekeee picture Miiekeee  路  3Comments

vanor89 picture vanor89  路  3Comments

MurhafSousli picture MurhafSousli  路  3Comments

julianobrasil picture julianobrasil  路  3Comments

kara picture kara  路  3Comments