3
3
@sortOrder 290
4
4
@description
5
5
6
+ # Forms
7
+
6
8
Controls (`input`, `select`, `textarea`) are ways for a user to enter data.
7
9
A Form is a collection of controls for the purpose of grouping related controls together.
8
10
@@ -14,7 +16,7 @@ be circumvented and thus can not be trusted. Server-side validation is still nec
14
16
secure application.
15
17
16
18
17
- # Simple form
19
+ ## Simple form
18
20
The key directive in understanding two-way data-binding is {@link ng.directive:ngModel ngModel}.
19
21
The `ngModel` directive provides the two-way data-binding by synchronizing the model to the view,
20
22
as well as view to the model. In addition it provides an {@link ngModel.NgModelController API}
@@ -62,7 +64,7 @@ For example: inputs of type `email` must have a value in the form of `user@domai
62
64
63
65
64
66
65
- # Using CSS classes
67
+ ## Using CSS classes
66
68
67
69
To allow styling of form as well as controls, `ngModel` adds these CSS classes:
68
70
@@ -126,7 +128,7 @@ and failing to satisfy its validity.
126
128
127
129
128
130
129
- # Binding to form and control state
131
+ ## Binding to form and control state
130
132
131
133
A form is an instance of {@link form.FormController FormController}.
132
134
The form instance can optionally be published into the scope using the `name` attribute.
@@ -208,7 +210,7 @@ didn't interact with a control
208
210
209
211
210
212
211
- # Custom model update triggers
213
+ ## Custom model update triggers
212
214
213
215
By default, any change to the content will trigger a model update and form validation. You can
214
216
override this behavior using the {@link ng.directive:ngModelOptions ngModelOptions} directive to
@@ -249,7 +251,7 @@ will update the model only when the control loses focus (blur event).
249
251
250
252
251
253
252
- # Non-immediate (debounced) model updates
254
+ ## Non-immediate (debounced) model updates
253
255
254
256
You can delay the model update/validation by using the `debounce` key with the
255
257
{@link ng.directive:ngModelOptions ngModelOptions} directive. This delay will also apply to
@@ -290,7 +292,7 @@ after last change.
290
292
</file>
291
293
</example>
292
294
293
- # Custom Validation
295
+ ## Custom Validation
294
296
295
297
Angular provides basic implementation for most common HTML5 {@link ng.directive:input input}
296
298
types: ({@link input[text] text}, {@link input[number] number}, {@link input[url] url},
@@ -407,7 +409,7 @@ In the following example we create two directives:
407
409
</file>
408
410
</example>
409
411
410
- # Modifying built-in validators
412
+ ## Modifying built-in validators
411
413
412
414
Since Angular itself uses `$validators`, you can easily replace or remove built-in validators,
413
415
should you find it necessary. The following example shows you how to overwrite the email validator
@@ -452,7 +454,7 @@ Note that you can alternatively use `ng-pattern` to further restrict the validat
452
454
</example>
453
455
454
456
455
- # Implementing custom form controls (using `ngModel`)
457
+ ## Implementing custom form controls (using `ngModel`)
456
458
Angular implements all of the basic HTML form controls ({@link ng.directive:input input},
457
459
{@link ng.directive:select select}, {@link ng.directive:textarea textarea}),
458
460
which should be sufficient for most cases. However, if you need more flexibility,
0 commit comments