How can I check for any field changes in a form? I would like to only enable a Save button if the underlying object has changed. Currently, I'm adding a ng-change="vm.formChanged()"
attribute to every single field on the form. I would much rather do this once at the form level and not decorate every single field.
My method looks something like this:
formChanged () {
vm.hasChanges = (JSON.stringify(vm.item) != JSON.stringify(vm.original));
}
... and I'm binding the Save button to ng-disabled="!vm.hasChanges"
.