0

Actually I'm creating the form dynamically and i have done two way binding also. Now I want to do the validation.

Requirements:

    1. If i have value in field for (eg. Name: Raja). If edit that value using $watch or $dirty we can check that modified or not. The same thing I want to get reverse also. Suppose I edited the value Raja to Raj and later again i'm adding the 'a' means Raja. If i give previous value again the status $dirty i should get false.
    1. How can do this thing for whole form rather than giving each and every field.

Please help me anyone on this.

Here is my Plunker for simple example.

2
  • You can write a directive and use it on each input of your form. Commented Aug 4, 2016 at 12:18
  • @Mistalis - can you please provide any example Commented Aug 4, 2016 at 12:42

1 Answer 1

1

you should use something like $setPristine() http://plnkr.co/edit/1LJ5alREMhFXOqO8ZWbj?p=preview

Sign up to request clarification or add additional context in comments.

2 Comments

I would like to ask you one more thing. here you're checking every field with changed value(newv) because you know the fields but my case dynamically we're creating the form I don't the field name. how can i do for that. Please help me.
it' maybe a little sally but since the two object are the same, and only valors change for (key in $scope.master) plnkr.co/edit/1LJ5alREMhFXOqO8ZWbj?p=preview

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.