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

Commit

Permalink
fix(FormController): propagate dirty state to parent forms
Browse files Browse the repository at this point in the history
  • Loading branch information
groner authored and mhevery committed Sep 6, 2012
1 parent a9be003 commit 0432915
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ng/directive/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ function FormController(element, attrs) {
element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS);
form.$dirty = true;
form.$pristine = false;
parentForm.$setDirty();
};

}
Expand Down
3 changes: 3 additions & 0 deletions test/ng/directive/formSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});


Expand Down

0 comments on commit 0432915

Please sign in to comment.