mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 15:40:22 +00:00
fix(FormController): propagate dirty state to parent forms
This commit is contained in:
parent
f02833d634
commit
3d7c752e27
2 changed files with 4 additions and 0 deletions
|
|
@ -117,6 +117,7 @@ function FormController(element, attrs) {
|
|||
element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS);
|
||||
form.$dirty = true;
|
||||
form.$pristine = false;
|
||||
parentForm.$setDirty();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue