(element, attrs, $scope, $animate, $interpolate)
| 20060 | //asks for $scope to fool the BC controller module |
| 20061 | FormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate']; |
| 20062 | function FormController(element, attrs, $scope, $animate, $interpolate) { |
| 20063 | var form = this, |
| 20064 | controls = []; |
| 20065 | |
| 20066 | // init state |
| 20067 | form.$error = {}; |
| 20068 | form.$$success = {}; |
| 20069 | form.$pending = undefined; |
| 20070 | form.$name = $interpolate(attrs.name || attrs.ngForm || '')($scope); |
| 20071 | form.$dirty = false; |
| 20072 | form.$pristine = true; |
| 20073 | form.$valid = true; |
| 20074 | form.$invalid = false; |
| 20075 | form.$submitted = false; |
| 20076 | form.$$parentForm = nullFormCtrl; |
| 20077 | |
| 20078 | /** |
| 20079 | * @ngdoc method |
| 20080 | * @name form.FormController#$rollbackViewValue |
| 20081 | * |
| 20082 | * @description |
| 20083 | * Rollback all form controls pending updates to the `$modelValue`. |
| 20084 | * |
| 20085 | * Updates may be pending by a debounced event or because the input is waiting for a some future |
| 20086 | * event defined in `ng-model-options`. This method is typically needed by the reset button of |
| 20087 | * a form that uses `ng-model-options` to pend updates. |
| 20088 | */ |
| 20089 | form.$rollbackViewValue = function() { |
| 20090 | forEach(controls, function(control) { |
| 20091 | control.$rollbackViewValue(); |
| 20092 | }); |
| 20093 | }; |
| 20094 | |
| 20095 | /** |
| 20096 | * @ngdoc method |
| 20097 | * @name form.FormController#$commitViewValue |
| 20098 | * |
| 20099 | * @description |
| 20100 | * Commit all form controls pending updates to the `$modelValue`. |
| 20101 | * |
| 20102 | * Updates may be pending by a debounced event or because the input is waiting for a some future |
| 20103 | * event defined in `ng-model-options`. This method is rarely needed as `NgModelController` |
| 20104 | * usually handles calling this in response to input events. |
| 20105 | */ |
| 20106 | form.$commitViewValue = function() { |
| 20107 | forEach(controls, function(control) { |
| 20108 | control.$commitViewValue(); |
| 20109 | }); |
| 20110 | }; |
| 20111 | |
| 20112 | /** |
| 20113 | * @ngdoc method |
| 20114 | * @name form.FormController#$addControl |
| 20115 | * @param {object} control control object, either a {@link form.FormController} or an |
| 20116 | * {@link ngModel.NgModelController} |
| 20117 | * |
| 20118 | * @description |
| 20119 | * Register a control with the form. Input elements using ngModelController do this automatically |
nothing calls this directly
no test coverage detected