I am currently working on a form that allows users to edit various fields. Some of these fields will automatically update with suggested values until the user makes changes ($dirty).
To ensure users can see which fields have been modified, I would like to visually indicate this change (such as flashing the border of the input).
My challenge is how to apply this visual indicator to all 50 inputs in the form.
For example, I have text inputs:
- X
- Y
- Area
- Perimeter
Typically, users will input values for X and Y. I have set up a $watch function on these fields that triggers a web service call (/calculate?x=3&y=2) returning {perimeter: 12; area: 6}. These values then autofill in the Area and Perimeter inputs. At this point, I want to add a CSS class to these fields to notify the user that they have been updated automatically.
While I could add the CSS class within the $watch function, I have multiple watchers and wish to avoid complicating the existing form further. Instead, I am considering implementing an "onchange" functionality that can identify inputs changed programmatically and be applied across multiple inputs (either through a directive on the form or individual inputs, or by adding a watcher specifically for the form fields, not just the model).