This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
docs(form): improve the docs for FormController.$setValidity()
#15984
Closed
Closed
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,17 +26,23 @@ function nullFormRenameControl(control, name) { | |
* @property {boolean} $dirty True if user has already interacted with the form. | ||
* @property {boolean} $valid True if all of the containing forms and controls are valid. | ||
* @property {boolean} $invalid True if at least one containing control or form is invalid. | ||
* @property {boolean} $pending True if at least one containing control or form is pending. | ||
* @property {boolean} $submitted True if user has submitted the form even if its invalid. | ||
* | ||
* @property {Object} $error Is an object hash, containing references to controls or | ||
* forms with failing validators, where: | ||
* @property {Object} $pending An object hash, containing references to controls or forms with | ||
* pending validators, where: | ||
* | ||
* - keys are validations tokens (error names). | ||
* - values are arrays of controls or forms that have a pending validator fot the given error name. | ||
* | ||
* See {@link form.FormController#$error $error} for a list of built-in validation tokens. | ||
* | ||
* @property {Object} $error An object hash, containing references to controls or forms with failing | ||
* validators, where: | ||
* | ||
* - keys are validation tokens (error names), | ||
* - values are arrays of controls or forms that have a failing validator for given error name. | ||
* - values are arrays of controls or forms that have a failing validator for the given error name. | ||
* | ||
* Built-in validation tokens: | ||
* | ||
* - `email` | ||
* - `max` | ||
* - `maxlength` | ||
|
@@ -282,9 +288,24 @@ FormController.prototype = { | |
* @name form.FormController#$setValidity | ||
* | ||
* @description | ||
* Sets the validity of a form control. | ||
* | ||
* This method will also propagate to parent forms. | ||
* Change the validity state of the form, and notify the parent form (if any). | ||
* | ||
* Application developers will rarely need to call this method directly. It is used internally, by | ||
* {@link ngModel.NgModelController#$setValidity NgModelController.$setValidity()}, to propagate a | ||
* control's validity state to parent `FormControllers`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would say "to the parent |
||
* | ||
* @param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be | ||
* assigned to either `$error[validationErrorKey]` or `$pending[validationErrorKey]` (for | ||
* unfulfilled `$asyncValidators`), so that it is available for data-binding. The | ||
* `validationErrorKey` should be in camelCase and will get converted into dash-case for | ||
* class name. Example: `myError` will result in `ng-valid-my-error` and | ||
* `ng-invalid-my-error` classes and can be bound to as `{{ someForm.$error.myError }}`. | ||
* @param {boolean} isValid Whether the current state is valid (true), invalid (false), pending | ||
* (undefined), or skipped (null). Pending is used for unfulfilled `$asyncValidators`. | ||
* Skipped is used by AngularJS when validators do not run because of parse errors and when | ||
* `$asyncValidators` do not run because any of the `$validators` failed. | ||
* @param {NgModelController | FormController} controller - The controller whose validity state is | ||
* triggering the change. | ||
*/ | ||
addSetValidityMethod({ | ||
clazz: FormController, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fot -> for