Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 0432915

Browse files
gronermhevery
authored andcommittedSep 6, 2012
fix(FormController): propagate dirty state to parent forms
1 parent a9be003 commit 0432915

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed
 

‎src/ng/directive/form.js

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ function FormController(element, attrs) {
117117
element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS);
118118
form.$dirty = true;
119119
form.$pristine = false;
120+
parentForm.$setDirty();
120121
};
121122

122123
}

‎test/ng/directive/formSpec.js

+3
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ describe('form', function() {
284284
inputB.$setValidity('MyError', true);
285285
expect(parent.$error.MyError).toBe(false);
286286
expect(child.$error.MyError).toBe(false);
287+
288+
child.$setDirty();
289+
expect(parent.$dirty).toBeTruthy();
287290
});
288291

289292

0 commit comments

Comments
 (0)