Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit b9a65fb

Browse files
committed
docs(guide/forms, ngModel): update list of css classes
1 parent 93f8895 commit b9a65fb

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

docs/content/guide/forms.ngdoc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,15 @@ Note that `novalidate` is used to disable browser's native form validation.
6060

6161
To allow styling of form as well as controls, `ngModel` adds these CSS classes:
6262

63-
- `ng-valid`
64-
- `ng-invalid`
65-
- `ng-pristine`
66-
- `ng-dirty`
67-
- `ng-touched`
68-
- `ng-untouched`
63+
- `ng-valid`: the model is valid
64+
- `ng-invalid`: the model is invalid
65+
- `ng-valid-[key]`: for each valid key added by `$setValidity`
66+
- `ng-invalid-[key]`: for each invalid key added by `$setValidity`
67+
- `ng-pristine`: the control hasn't been changed yet
68+
- `ng-dirty`: the control has been changed
69+
- `ng-touched`: the control has been blurred
70+
- `ng-untouched`: the control hasn't been blurred
71+
- `ng-pending`: any `$asyncValidators` are unfulfilled
6972

7073
The following example uses the CSS to display validity of each form control.
7174
In the example both `user.name` and `user.email` are required, but are rendered with red background only when they are dirty.

src/ng/directive/input.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2280,10 +2280,15 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
22802280
* The following CSS classes are added and removed on the associated input/select/textarea element
22812281
* depending on the validity of the model.
22822282
*
2283-
* - `ng-valid` is set if the model is valid.
2284-
* - `ng-invalid` is set if the model is invalid.
2285-
* - `ng-pristine` is set if the model is pristine.
2286-
* - `ng-dirty` is set if the model is dirty.
2283+
* - `ng-valid`: the model is valid
2284+
* - `ng-invalid`: the model is invalid
2285+
* - `ng-valid-[key]`: for each valid key added by `$setValidity`
2286+
* - `ng-invalid-[key]`: for each invalid key added by `$setValidity`
2287+
* - `ng-pristine`: the control hasn't been changed yet
2288+
* - `ng-dirty`: the control has been changed
2289+
* - `ng-touched`: the control has been blurred
2290+
* - `ng-untouched`: the control hasn't been blurred
2291+
* - `ng-pending`: any `$asyncValidators` are unfulfilled
22872292
*
22882293
* Keep in mind that ngAnimate can detect each of these classes when added and removed.
22892294
*

0 commit comments

Comments
 (0)