MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / FormController

Function FormController

lib/test/angular/1.4.3/angular.js:19916–20137  ·  view source on GitHub ↗
(element, attrs, $scope, $animate, $interpolate)

Source from the content-addressed store, hash-verified

19914//asks for $scope to fool the BC controller module
19915FormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate'];
19916function FormController(element, attrs, $scope, $animate, $interpolate) {
19917 var form = this,
19918 controls = [];
19919
19920 var parentForm = form.$$parentForm = element.parent().controller('form') || nullFormCtrl;
19921
19922 // init state
19923 form.$error = {};
19924 form.$$success = {};
19925 form.$pending = undefined;
19926 form.$name = $interpolate(attrs.name || attrs.ngForm || '')($scope);
19927 form.$dirty = false;
19928 form.$pristine = true;
19929 form.$valid = true;
19930 form.$invalid = false;
19931 form.$submitted = false;
19932
19933 parentForm.$addControl(form);
19934
19935 /**
19936 * @ngdoc method
19937 * @name form.FormController#$rollbackViewValue
19938 *
19939 * @description
19940 * Rollback all form controls pending updates to the `$modelValue`.
19941 *
19942 * Updates may be pending by a debounced event or because the input is waiting for a some future
19943 * event defined in `ng-model-options`. This method is typically needed by the reset button of
19944 * a form that uses `ng-model-options` to pend updates.
19945 */
19946 form.$rollbackViewValue = function() {
19947 forEach(controls, function(control) {
19948 control.$rollbackViewValue();
19949 });
19950 };
19951
19952 /**
19953 * @ngdoc method
19954 * @name form.FormController#$commitViewValue
19955 *
19956 * @description
19957 * Commit all form controls pending updates to the `$modelValue`.
19958 *
19959 * Updates may be pending by a debounced event or because the input is waiting for a some future
19960 * event defined in `ng-model-options`. This method is rarely needed as `NgModelController`
19961 * usually handles calling this in response to input events.
19962 */
19963 form.$commitViewValue = function() {
19964 forEach(controls, function(control) {
19965 control.$commitViewValue();
19966 });
19967 };
19968
19969 /**
19970 * @ngdoc method
19971 * @name form.FormController#$addControl
19972 *
19973 * @description

Callers

nothing calls this directly

Calls 5

$interpolateFunction · 0.70
forEachFunction · 0.70
assertNotHasOwnPropertyFunction · 0.70
arrayRemoveFunction · 0.70
addSetValidityMethodFunction · 0.70

Tested by

no test coverage detected