(element, attrs, $scope, $animate, $interpolate)
| 21053 | //asks for $scope to fool the BC controller module |
| 21054 | FormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate']; |
| 21055 | function FormController(element, attrs, $scope, $animate, $interpolate) { |
| 21056 | var form = this, |
| 21057 | controls = []; |
| 21058 | |
| 21059 | // init state |
| 21060 | form.$error = {}; |
| 21061 | form.$$success = {}; |
| 21062 | form.$pending = undefined; |
| 21063 | form.$name = $interpolate(attrs.name || attrs.ngForm || '')($scope); |
| 21064 | form.$dirty = false; |
| 21065 | form.$pristine = true; |
| 21066 | form.$valid = true; |
| 21067 | form.$invalid = false; |
| 21068 | form.$submitted = false; |
| 21069 | form.$$parentForm = nullFormCtrl; |
| 21070 | |
| 21071 | /** |
| 21072 | * @ngdoc method |
| 21073 | * @name form.FormController#$rollbackViewValue |
| 21074 | * |
| 21075 | * @description |
| 21076 | * Rollback all form controls pending updates to the `$modelValue`. |
| 21077 | * |
| 21078 | * Updates may be pending by a debounced event or because the input is waiting for a some future |
| 21079 | * event defined in `ng-model-options`. This method is typically needed by the reset button of |
| 21080 | * a form that uses `ng-model-options` to pend updates. |
| 21081 | */ |
| 21082 | form.$rollbackViewValue = function() { |
| 21083 | forEach(controls, function(control) { |
| 21084 | control.$rollbackViewValue(); |
| 21085 | }); |
| 21086 | }; |
| 21087 | |
| 21088 | /** |
| 21089 | * @ngdoc method |
| 21090 | * @name form.FormController#$commitViewValue |
| 21091 | * |
| 21092 | * @description |
| 21093 | * Commit all form controls pending updates to the `$modelValue`. |
| 21094 | * |
| 21095 | * Updates may be pending by a debounced event or because the input is waiting for a some future |
| 21096 | * event defined in `ng-model-options`. This method is rarely needed as `NgModelController` |
| 21097 | * usually handles calling this in response to input events. |
| 21098 | */ |
| 21099 | form.$commitViewValue = function() { |
| 21100 | forEach(controls, function(control) { |
| 21101 | control.$commitViewValue(); |
| 21102 | }); |
| 21103 | }; |
| 21104 | |
| 21105 | /** |
| 21106 | * @ngdoc method |
| 21107 | * @name form.FormController#$addControl |
| 21108 | * @param {object} control control object, either a {@link form.FormController} or an |
| 21109 | * {@link ngModel.NgModelController} |
| 21110 | * |
| 21111 | * @description |
| 21112 | * Register a control with the form. Input elements using ngModelController do this automatically |
nothing calls this directly
no test coverage detected