angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

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

Open martinschulzofficial opened this issue 10 years ago • 4 comments

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

Closes #13715

martinschulzofficial avatar Jan 15 '16 02:01 martinschulzofficial

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

We need to properly handle added/removed controls.

gkalpak avatar Jan 15 '16 11:01 gkalpak

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).

martinschulzofficial avatar Jan 16 '16 23:01 martinschulzofficial

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 :+1:

gkalpak avatar Jan 18 '16 11:01 gkalpak

Has this been split?

petebacondarwin avatar Jan 20 '16 06:01 petebacondarwin