Как указано в комментариях, вы хотите проверить $dirty
свойство каждого элемента формы.
Смотрите пример здесь https://next.plnkr.co/edit/YW7ad8vYjfE9jnLW?preview
HTML
<body ng-controller="MainCtrl" ng-cloak>
<form name="userForm">
<div>
Name:
<input
name="name"
type="text"
ng-model="user.name"
ng-change="getChanges(userForm)">
Age:
<input
name="age"
type="number"
ng-model="user.age"
ng-change="getChanges(userForm)">
Gender:
<select
name="gender"
ng-model="user.gender"
ng-change="getChanges(userForm)">
<option value="M">M</option>
<option value="F">F</option>
<option value="O">Other</option>
</select>
</div>
<div>
<button
name="reset"
type="button"
ng-click="setPristine(userForm)">Set pristine
</button>
</div>
</form>
<div>
User changed values: {{ changedValues | json }}
</div>
</body>
JavaScript
angular.module('app', []).controller('MainCtrl', function($scope, $timeout) {
angular.extend($scope, {
user: {
name: null,
age: null,
gender: null
},
changedValues: {},
getChanges: function(form) {
$scope.changedValues = {};
angular.forEach(form, function(value, key) {
if (!key.startsWith('$')) {
if (value.$dirty) {
$scope.changedValues[key] = value.$modelValue;
}
}
});
},
setPristine: function(form) {
form.$setPristine();
$scope.getChanges(form);
}
});
$timeout($scope.reset);
});