Promact / md2

Angular2 based Material Design components, directives and services are Accordion, Autocomplete, Collapse, Colorpicker, Datepicker, Dialog(Modal), Menu, Multiselect, Select, Tabs, Tags(Chips), Toast and Tooltip.
http://code.promactinfo.com/md2/
MIT License
379 stars 112 forks source link

Colorpicker does not triggered change event with a wrong or empty value #256

Open dimzeta opened 7 years ago

dimzeta commented 7 years ago

Bug, feature request, or proposal:

Bug

What is the expected behavior?

When we put a wrong or an empty value, the model should be have this new value.

What is the current behavior?

The model has a new value only when this is a correct value.

What are the steps to reproduce?

My plunker : http://plnkr.co/edit/481ewmoT6twi0sYulBWS?p=preview

Set a new color to see the value change in the model, then remove it. The old value still here. Now put a wrong value, like "WrongValue", nothing happens. This is a little annoying with an ngForm behind.

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

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

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

Is there anything else we should know?

krupa310 commented 7 years ago

@dimitribocquet If you set wrong value/blank value then it will set #000000 as a default color.Wrong value can not bind in the model, it will take only valid color value.

dimzeta commented 7 years ago

That sounds a logic behavior, but when I use a ngForm with it, the form is never warned that the value is wrong, because as you said it hasn't changed. So from UX view, we can still submit the form (form.valid == true) with a wrong value.

Maybe we should be able to allow to bind it in the model even if it's wrong, with an @Input parameter?