Re: [angular.js] How to mark an input "not-dirty"

2,568 views
Skip to first unread message

Pawel Kozlowski

unread,
Jul 7, 2012, 11:05:32 AM7/7/12
to ang...@googlegroups.com
Hi!

Basically you are running into https://github.com/angular/angular.js/issues/856

I've got a fix for this on my local machine an prepare the pull
request as we speak - just need to update docs etc. so should send the
pull request today. Feel free to leave the comment / up-vote the issue
so its get merged :-)

Cheers,
Pawel

On Sat, Jul 7, 2012 at 5:00 PM, Freewind <nowi...@gmail.com> wrote:
> I set the style for `ng-dirty` to `background-color: yellow`. Then we I
> modify the value of input, its background color becomes yellow.
>
> Is there any way to set it as not dirty? E.g. when I click a "save" button,
> I saved the new value, so I can treat it "not-dirty" now.
>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/angular/-/qPUhENcKFfMJ.
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to
> angular+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/angular?hl=en.

Pawel Kozlowski

unread,
Jul 7, 2012, 1:30:37 PM7/7/12
to ang...@googlegroups.com
Hi!

On Sat, Jul 7, 2012 at 5:08 PM, Freewind <nowi...@gmail.com> wrote:
> Voted, and thanks!

OK, just sent a pull request with the fix:
https://github.com/angular/angular.js/pull/1127

Here is a jsFiddle that shows an issue:
http://jsfiddle.net/pkozlowski_opensource/qT9pu/2/ (just type sth in a
field and then delete it).

Here is another jsFillde with the issue fixed:
http://jsfiddle.net/pkozlowski_opensource/2x8HD/4/ (just type sth in a
field and then delete it and click on 'Revert edits').

Hopefully it will get merged (if this is correct way of fixing it of course!).

Cheers,
Pawel

Petr Kotek

unread,
Apr 21, 2013, 9:50:03 PM4/21/13
to ang...@googlegroups.com
If someone would come across this thread: "FormController.$setPristine()" method is now in the official release since v1.0.3 and v.1.1.1; see http://blog.angularjs.org/2012...


(Note that the method is really named $setPristine(), not $setpristine() as mentioned in the blog)

Reply all
Reply to author
Forward
0 new messages