fix(FormController): propagate dirty state to parent forms

This commit is contained in:
Kai Groner 2012-06-06 23:23:43 -04:00 committed by Misko Hevery
parent a9be003fce
commit 04329151d2
2 changed files with 4 additions and 0 deletions

View file

@ -117,6 +117,7 @@ function FormController(element, attrs) {
element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS);
form.$dirty = true;
form.$pristine = false;
parentForm.$setDirty();
};
}

View file

@ -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();
});