fix(formController): remove scope reference when form is destroyed

Closes #9315
This commit is contained in:
Shahar Talmi
2014-09-28 11:02:50 +03:00
committed by Igor Minar
parent 9f2ad53084
commit 01f50e1a7b
2 changed files with 27 additions and 9 deletions

View File

@@ -495,15 +495,13 @@ var formDirectiveFactory = function(isNgForm) {
parentFormCtrl.$$renameControl(controller, alias);
});
}
if (parentFormCtrl !== nullFormCtrl) {
formElement.on('$destroy', function() {
parentFormCtrl.$removeControl(controller);
if (alias) {
setter(scope, alias, undefined, alias);
}
extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
});
}
formElement.on('$destroy', function() {
parentFormCtrl.$removeControl(controller);
if (alias) {
setter(scope, alias, undefined, alias);
}
extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
});
}
};
}