Components: [Checkbox] Improve docs on MatCheckboxClickAction

Created on 8 Dec 2017  路  8Comments  路  Source: angular/components

Bug, feature request, or proposal:

Documentation Request

What is the expected behavior?

Clearer documentation on how to change the MatCheckboxClickAction of a checkbox

What is the current behavior?

The current documentation is unhelpful. It is unclear how to alter the default value of MatCheckboxClickAction. An example would be helpful.
See Current Documentation

P3 docs has pr

Most helpful comment

Why can't this just be an option on the checkbox itself :-/

All 8 comments

I've read the PR with the updated docs but still couldn't implement it. Any way it could be updated with a working sample? It would be very helpful. Thanks

+1

A working example on stackblitz:
https://stackblitz.com/edit/angular-zstr9w?file=main.ts

Changing provided value in providers: [{provide: MAT_CHECKBOX_CLICK_ACTION, useValue: 'check-indeterminate'}] in main.ts will have different results.

@tinayuangao
Thanks for the sample provided. I managed to get it working on https://stackblitz.com/edit/angular-zstr9w-tlgtfj?file=app%2Fcheckbox-configurable-example.ts

But it is still not clear how would I apply it to a single checkbox on my component? Should I create an TriState component containing a MatCheckbox component in it? Or is there a better way?

Thanks

I have implemented it by creating a new component.

Would like to know if it is the correct approach?

Here is an example: https://stackblitz.com/edit/angular-uew4l8

Could anyone assess it? Thanks!

Thanks @tinayuangao and @hobojoe!

Why can't this just be an option on the checkbox itself :-/

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

MurhafSousli picture MurhafSousli  路  3Comments

dzrust picture dzrust  路  3Comments

jelbourn picture jelbourn  路  3Comments

shlomiassaf picture shlomiassaf  路  3Comments

constantinlucian picture constantinlucian  路  3Comments