Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a1c4f6f

Browse files
jdavisp3petebacondarwin
authored andcommittedSep 19, 2013
docs(ngForm): fix grammar and improve explanation
Closes #4050
1 parent 04c9cae commit a1c4f6f

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed
 

‎src/ng/directive/form.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,19 @@ function FormController(element, attrs) {
217217
* Directive that instantiates
218218
* {@link ng.directive:form.FormController FormController}.
219219
*
220-
* If `name` attribute is specified, the form controller is published onto the current scope under
220+
* If the `name` attribute is specified, the form controller is published onto the current scope under
221221
* this name.
222222
*
223223
* # Alias: {@link ng.directive:ngForm `ngForm`}
224224
*
225-
* In angular forms can be nested. This means that the outer form is valid when all of the child
226-
* forms are valid as well. However browsers do not allow nesting of `<form>` elements, for this
227-
* reason angular provides {@link ng.directive:ngForm `ngForm`} alias
228-
* which behaves identical to `<form>` but allows form nesting.
225+
* In Angular forms can be nested. This means that the outer form is valid when all of the child
226+
* forms are valid as well. However, browsers do not allow nesting of `<form>` elements, so
227+
* Angular provides the {@link ng.directive:ngForm `ngForm`} directive which behaves identically to
228+
* `<form>` but can be nested. This allows you to have nested forms, which is very useful when
229+
* using Angular validation directives in forms that are dynamically generated using the
230+
* {@link ng.directive:ngRepeat `ngRepeat`} directive. Since you cannot dynamically generate the `name`
231+
* attribute of input elements using interpolation, you have to wrap each set of repeated inputs in an
232+
* `ngForm` directive and nest these in an outer `form` element.
229233
*
230234
*
231235
* # CSS classes
@@ -235,12 +239,12 @@ function FormController(element, attrs) {
235239
* - `ng-dirty` Is set if the form is dirty.
236240
*
237241
*
238-
* # Submitting a form and preventing default action
242+
* # Submitting a form and preventing the default action
239243
*
240244
* Since the role of forms in client-side Angular applications is different than in classical
241245
* roundtrip apps, it is desirable for the browser not to translate the form submission into a full
242246
* page reload that sends the data to the server. Instead some javascript logic should be triggered
243-
* to handle the form submission in application specific way.
247+
* to handle the form submission in an application-specific way.
244248
*
245249
* For this reason, Angular prevents the default action (form submission to the server) unless the
246250
* `<form>` element has an `action` attribute specified.
@@ -252,8 +256,9 @@ function FormController(element, attrs) {
252256
* - {@link ng.directive:ngClick ngClick} directive on the first
253257
* button or input field of type submit (input[type=submit])
254258
*
255-
* To prevent double execution of the handler, use only one of ngSubmit or ngClick directives. This
256-
* is because of the following form submission rules coming from the html spec:
259+
* To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit}
260+
* or {@link ng.directive:ngClick ngClick} directives.
261+
* This is because of the following form submission rules in the HTML specification:
257262
*
258263
* - If a form has only one input field then hitting enter in this field triggers form submit
259264
* (`ngSubmit`)

0 commit comments

Comments
 (0)
This repository has been archived.