(element, attrs, $scope, $animate, $interpolate)
| 20575 | //asks for $scope to fool the BC controller module |
| 20576 | FormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate']; |
| 20577 | function FormController(element, attrs, $scope, $animate, $interpolate) { |
| 20578 | var form = this, |
| 20579 | controls = []; |
| 20580 | |
| 20581 | // init state |
| 20582 | form.$error = {}; |
| 20583 | form.$$success = {}; |
| 20584 | form.$pending = undefined; |
| 20585 | form.$name = $interpolate(attrs.name || attrs.ngForm || '')($scope); |
| 20586 | form.$dirty = false; |
| 20587 | form.$pristine = true; |
| 20588 | form.$valid = true; |
| 20589 | form.$invalid = false; |
| 20590 | form.$submitted = false; |
| 20591 | form.$$parentForm = nullFormCtrl; |
| 20592 | |
| 20593 | /** |
| 20594 | * @ngdoc method |
| 20595 | * @name form.FormController#$rollbackViewValue |
| 20596 | * |
| 20597 | * @description |
| 20598 | * Rollback all form controls pending updates to the `$modelValue`. |
| 20599 | * |
| 20600 | * Updates may be pending by a debounced event or because the input is waiting for a some future |
| 20601 | * event defined in `ng-model-options`. This method is typically needed by the reset button of |
| 20602 | * a form that uses `ng-model-options` to pend updates. |
| 20603 | */ |
| 20604 | form.$rollbackViewValue = function() { |
| 20605 | forEach(controls, function(control) { |
| 20606 | control.$rollbackViewValue(); |
| 20607 | }); |
| 20608 | }; |
| 20609 | |
| 20610 | /** |
| 20611 | * @ngdoc method |
| 20612 | * @name form.FormController#$commitViewValue |
| 20613 | * |
| 20614 | * @description |
| 20615 | * Commit all form controls pending updates to the `$modelValue`. |
| 20616 | * |
| 20617 | * Updates may be pending by a debounced event or because the input is waiting for a some future |
| 20618 | * event defined in `ng-model-options`. This method is rarely needed as `NgModelController` |
| 20619 | * usually handles calling this in response to input events. |
| 20620 | */ |
| 20621 | form.$commitViewValue = function() { |
| 20622 | forEach(controls, function(control) { |
| 20623 | control.$commitViewValue(); |
| 20624 | }); |
| 20625 | }; |
| 20626 | |
| 20627 | /** |
| 20628 | * @ngdoc method |
| 20629 | * @name form.FormController#$addControl |
| 20630 | * @param {object} control control object, either a {@link form.FormController} or an |
| 20631 | * {@link ngModel.NgModelController} |
| 20632 | * |
| 20633 | * @description |
| 20634 | * Register a control with the form. Input elements using ngModelController do this automatically |
nothing calls this directly
no test coverage detected