Getting form controls from FormController

For a direct solution to the question, modify @lombardo’s answer like so; var dirtyFormControls = []; var myForm = $scope.myForm; angular.forEach(myForm, function(value, key) { if (typeof value === ‘object’ && value.hasOwnProperty(‘$modelValue’) && value.$dirty) dirtyFormControls.push(value) }); The array ‘dirtyFormControls’ will then contain the form controls that are dirty. You can also use this trick to show … Read more

Angular ng-repeat with ng-form, accessing validation in controller

Updated 2015-01-17: As pointed out by Leblanc Meneses in the comments Angular 1.3 now supports interpolation with form, ngForm and input directives. This means that using expressions to name your elements: <div ng-form=”namesForm_{{$index}}” ng-repeat=”name in names”> <input type=”text” name=”input_{{$index}}_0″></input> <!– … –> </div> will work as expected: $scope[‘namesForm_0’] $scope.namesForm_1 // Access nested form elements: $scope.namesForm_1.input_1_0 … Read more