aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIgor Minar2013-11-04 10:32:23 -0800
committerIgor Minar2013-11-04 10:35:51 -0800
commit8f989d652f70fd147f66a18411070c7b939e242e (patch)
tree5400ef23b01d7b3f90428fd595fc8ac3af0c8162 /src
parent9483373c331343648e079420b3eb1f564d410ff2 (diff)
downloadangular.js-8f989d652f70fd147f66a18411070c7b939e242e.tar.bz2
fix(ngModel): deregister from the form on scope not DOM destruction
Due to animations, DOM might get destroyed much later than scope and so the element $destroy event might get fired outside of $digest, which causes changes to the validation model go unobserved until the next digest. By deregistering on scope event, the deregistration always happens in $digest and the form validation model changes will be observed. Closes #4226 Closes #4779
Diffstat (limited to 'src')
-rw-r--r--src/ng/directive/input.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js
index cc97411a..1c37167d 100644
--- a/src/ng/directive/input.js
+++ b/src/ng/directive/input.js
@@ -1222,7 +1222,7 @@ var ngModelDirective = function() {
formCtrl.$addControl(modelCtrl);
- element.on('$destroy', function() {
+ scope.$on('$destroy', function() {
formCtrl.$removeControl(modelCtrl);
});
}