You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 29, 2019. It is now read-only.
<div><divng-repeat="group in groups"><timepickerng-model="group.when"></timepicker></div></div>
The timepicker element is immediately marked dirty/triggers the change event. This is problematic when attempting to check for changes on page unload as there will always be detected changes. See here: http://plnkr.co/Ic2HA390OI2xheT38Izz
I have managed to work around the issue by modifying the directive, but I'm not sure that my change is safe. The modification is to the refresh() function:
My change was not entirely safe. If the timepicker was invalidated (by, say, deleting one of the component values) then it would continuously fail to validate afterwards. I tweaked the modification slightly.
From some experimentation, it appears that what is causing the form to be set as dirty is the refresh function being called twice, once for having a valid hours value and once for having a valid minutes value.
The correct fix then should be to check if each function is called for the first time on load, set the form to pristine, then toggle an internal variable so that the form cannot be set to pristine again via these mechanisms.
Using just Angular 1.3.3 and Angular-UI 0.12.0, when the following code loads:
JS:
HTML:
The timepicker element is immediately marked dirty/triggers the change event. This is problematic when attempting to check for changes on page unload as there will always be detected changes. See here:
http://plnkr.co/Ic2HA390OI2xheT38Izz
This does not happen outside ngRepeat, or with a simple text input inside the ngRepeat. See here:
http://plnkr.co/s0KwGrZkHaog4efyjGBK
I have managed to work around the issue by modifying the directive, but I'm not sure that my change is safe. The modification is to the refresh() function:
The text was updated successfully, but these errors were encountered: