aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Groner2012-06-06 23:23:43 -0400
committerMisko Hevery2012-09-06 16:06:26 -0700
commit04329151d2df833f803629cefa781aa6409fe6a5 (patch)
treead312a793fc9be5909dfad649b07d339ade8ef16
parenta9be003fce4b42077448481b3b067c5f81c063f6 (diff)
downloadangular.js-04329151d2df833f803629cefa781aa6409fe6a5.tar.bz2
fix(FormController): propagate dirty state to parent forms
-rw-r--r--src/ng/directive/form.js1
-rw-r--r--test/ng/directive/formSpec.js3
2 files changed, 4 insertions, 0 deletions
diff --git a/src/ng/directive/form.js b/src/ng/directive/form.js
index 6b876e01..4f06f093 100644
--- a/src/ng/directive/form.js
+++ b/src/ng/directive/form.js
@@ -117,6 +117,7 @@ function FormController(element, attrs) {
element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS);
form.$dirty = true;
form.$pristine = false;
+ parentForm.$setDirty();
};
}
diff --git a/test/ng/directive/formSpec.js b/test/ng/directive/formSpec.js
index 51c6929f..2fd55f60 100644
--- a/test/ng/directive/formSpec.js
+++ b/test/ng/directive/formSpec.js
@@ -284,6 +284,9 @@ describe('form', function() {
inputB.$setValidity('MyError', true);
expect(parent.$error.MyError).toBe(false);
expect(child.$error.MyError).toBe(false);
+
+ child.$setDirty();
+ expect(parent.$dirty).toBeTruthy();
});