fix(FormController): propagate dirty state to parent forms
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user