ng2-semantic-ui
ng2-semantic-ui copied to clipboard
fix(datepicker): Changed handling of value change
Thank you in advance that you make this library.
I tried to resolve bug i have found.
From angular docs for ControlValueAccessor:
writeValue
- This method will be called by the forms API to write to the view when programmatic (model -> view) changes are requested.
onChange
- ... update the form model when values propagate from the view (view -> model).
There was call from writeValue
method to onChange
event. That makes control dirty for initial value. I have added new event onViewValueChange
used to update input value.
I have changed how value is set from input to component. Changing value trough input changes model -> should fire onChange
event and not call writeValue
.
I made little change in documentation - IMHO there was missing ngModel atribute.