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

fix(form): make ngForm $pristine after nested control.$setPristine() (counter version) - #13773

Open
martinschulzofficial wants to merge 2 commits into
angular:masterfrom
martinschulzofficial:ng-form-set-pristine
Open

fix(form): make ngForm $pristine after nested control.$setPristine() (counter version)#13773
martinschulzofficial wants to merge 2 commits into
angular:masterfrom
martinschulzofficial:ng-form-set-pristine

Conversation

@martinschulzofficial

Copy link
Copy Markdown

When calling $setPristine on the nested form or control,
form becomes $pristine of all the nested controls are pristine

Closes #13715

When calling $setPristine on the nested form or control,
form becomes $pristine of all the nested controls are pristine

Closes angular#13715
Comment thread test/ng/directive/formSpec.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should change this to expect(form.$dirty).toBe(false); and remove the subsequent call to form.$setPristine().

@gkalpak

gkalpak commented Jan 15, 2016

Copy link
Copy Markdown
Member

It generally LGTM (with a couple of nitpicks), BUT:

We need to properly handle added/removed controls.

@Narretz Narretz modified the milestones: 1.6.x, Backlog Jan 15, 2016
@Narretz
Narretz force-pushed the master branch 2 times, most recently from 70049ae to b77e14b Compare January 16, 2016 21:59
@martinschulzofficial

Copy link
Copy Markdown
Author

Now it uses internal counter. It's a bit complicated, because we have to divide $setPristine propagtion into capturing and bubbling.
Also I'm not 100% sure that idempotence test cases are sufficient (I think this is crucial).

@gkalpak

gkalpak commented Jan 18, 2016

Copy link
Copy Markdown
Member

I think it's best to have the two alternative approaches as two independent PRs (so we can review/update/decide upon separately).
Could you split revert the second commit and put it into a separate PR ?

Thx @linoleum-js for working on this, btw 👍

@martinschulzofficial martinschulzofficial changed the title fix(form): make ngForm $pristine after nested control.$setPristine() Jan 19, 2016
@petebacondarwin

Copy link
Copy Markdown
Contributor

Has this been split?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.