(element, attrs, $scope, $animate, $interpolate)
| 22697 | //asks for $scope to fool the BC controller module |
| 22698 | FormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate']; |
| 22699 | function FormController(element, attrs, $scope, $animate, $interpolate) { |
| 22700 | var form = this, |
| 22701 | controls = []; |
| 22702 | |
| 22703 | // init state |
| 22704 | form.$error = {}; |
| 22705 | form.$$success = {}; |
| 22706 | form.$pending = undefined; |
| 22707 | form.$name = $interpolate(attrs.name || attrs.ngForm || '')($scope); |
| 22708 | form.$dirty = false; |
| 22709 | form.$pristine = true; |
| 22710 | form.$valid = true; |
| 22711 | form.$invalid = false; |
| 22712 | form.$submitted = false; |
| 22713 | form.$$parentForm = nullFormCtrl; |
| 22714 | |
| 22715 | /** |
| 22716 | * @ngdoc method |
| 22717 | * @name form.FormController#$rollbackViewValue |
| 22718 | * |
| 22719 | * @description |
| 22720 | * Rollback all form controls pending updates to the `$modelValue`. |
| 22721 | * |
| 22722 | * Updates may be pending by a debounced event or because the input is waiting for a some future |
| 22723 | * event defined in `ng-model-options`. This method is typically needed by the reset button of |
| 22724 | * a form that uses `ng-model-options` to pend updates. |
| 22725 | */ |
| 22726 | form.$rollbackViewValue = function() { |
| 22727 | forEach(controls, function(control) { |
| 22728 | control.$rollbackViewValue(); |
| 22729 | }); |
| 22730 | }; |
| 22731 | |
| 22732 | /** |
| 22733 | * @ngdoc method |
| 22734 | * @name form.FormController#$commitViewValue |
| 22735 | * |
| 22736 | * @description |
| 22737 | * Commit all form controls pending updates to the `$modelValue`. |
| 22738 | * |
| 22739 | * Updates may be pending by a debounced event or because the input is waiting for a some future |
| 22740 | * event defined in `ng-model-options`. This method is rarely needed as `NgModelController` |
| 22741 | * usually handles calling this in response to input events. |
| 22742 | */ |
| 22743 | form.$commitViewValue = function() { |
| 22744 | forEach(controls, function(control) { |
| 22745 | control.$commitViewValue(); |
| 22746 | }); |
| 22747 | }; |
| 22748 | |
| 22749 | /** |
| 22750 | * @ngdoc method |
| 22751 | * @name form.FormController#$addControl |
| 22752 | * @param {object} control control object, either a {@link form.FormController} or an |
| 22753 | * {@link ngModel.NgModelController} |
| 22754 | * |
| 22755 | * @description |
| 22756 | * Register a control with the form. Input elements using ngModelController do this automatically |
nothing calls this directly
no test coverage detected