I found a problem in the implementation of the ControlValueAccessor, which is most noticeable in template driven forms.
When you bind a model value via a non-null default, the control (and thus the entire form) is not pristine.
The problem is, that you are calling the onChange callback in the writeValue method. The onChange callback is supposed to be called when the view wants to update the model. See https://angular.io/api/forms/ControlValueAccessor#registeronchange
I've added some unit tests to highlight the problem and implemented a fix.
I wasn't sure about the projects code style, since tslint is demanding one style but implemented is another (e.g. quote marks). Let me know if you want me to adjust anything.
Hi, thanks for sharing your color picker library.
I found a problem in the implementation of the ControlValueAccessor, which is most noticeable in template driven forms. When you bind a model value via a non-null default, the control (and thus the entire form) is not pristine. The problem is, that you are calling the onChange callback in the writeValue method. The onChange callback is supposed to be called when the view wants to update the model. See https://angular.io/api/forms/ControlValueAccessor#registeronchange
I've added some unit tests to highlight the problem and implemented a fix.
I wasn't sure about the projects code style, since tslint is demanding one style but implemented is another (e.g. quote marks). Let me know if you want me to adjust anything.