Well, you could bind each form field to a scope object and $watch the object for changes
scope.myForm = { field1: 'initial_value', field2: null, field3: false } scope.$watch('myForm', function(newFields, oldFields) { if (newFields.field2.length) { scope.buttonDisabled = true; } else if (!newFields.field3){ scope.buttonDisabled = true; } }, true); //notice this tells the $watcher that it's to catch any change on the object On Monday, April 13, 2015 at 4:33:06 AM UTC-6, ADITYA wrote: > > Hi, > > I have a scenario, where on page load, I have to disable Save button & > Button will be enabled only when there is some change in form(DOM). > Here one case is also that after making changes if we revert the changes > then button should be disabled. > I want to make a watch on Form(DOM). > > Here My question is how to make a watch on Form data. > How to store Firm initial data. > How to compare old data with new data(After any changes) to show button > enabled. > > > > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.