` and bind
+ its `hidden` property to the `HeroFormComponent.submitted` property.
+
++makeExample('forms/js/app/hero-form.component.html', 'edit-div', 'app/hero-form.component.html (excerpt)')(format=".")
+
+:marked
+ The main form is visible from the start because the
+ the `submitted` property is false until we submit the form,
+ as this fragment from the `HeroFormComponent` reminds us:
+
++makeExample('forms/js/app/hero-form.component.js', 'submitted')(format=".")
+
+:marked
+ When we click the Submit button, the `submitted` flag becomes true and the form disappears
+ as planned.
+
+ Now we need to show something else while the form is in the submitted state.
+ Add the following block of HTML below the `
` wrapper we just wrote:
++makeExample('forms/js/app/hero-form.component.html', 'submitted', 'app/hero-form.component.html (excerpt)')
+
+:marked
+ There's our hero again, displayed read-only with interpolation bindings.
+ This slug of HTML only appears while the component is in the submitted state.
+
+ We added an Edit button whose click event is bound to an expression
+ that clears the `submitted` flag.
+
+ When we click it, this block disappears and the editable form reappears.
+
+ That's as much drama as we can muster for now.
+
+.l-main-section
+:marked
+ ## Conclusion
+
+ The Angular 2 form discussed in this chapter takes advantage of the following framework features to provide support for data modification, validation and more:
+
+ - An Angular HTML form template.
+ - A form component class with a `Component` decorator.
+ - The `ngSubmit` directive for handling the form submission.
+ - Template local variables such as `#heroForm`, `#name`, `#alter-ego` and `#power`.
+ - The `ngModel` directive for two-way data binding.
+ - The `ngControl` for validation and form element change tracking.
+ - The local variable’s `valid` property on input controls to check if a control is valid and show/hide error messages.
+ - Controlling the submit button's enabled state by binding to `NgForm` validity.
+ - Custom CSS classes that provide visual feedback to users about invalid controls.
+
+ Our final project folder structure should look like this:
+code-example(format="").
+ angular2-forms
+ ├── node_modules
+ ├── app
+ | ├── app.component.js
+ | ├── boot.js
+ | ├── hero.js
+ | ├── hero-form.component.html
+ | └── hero-form.component.js
+ ├── index.html
+ ├── styles.css
+ ├── tsconfig.json
+ └── package.json
+:marked
+ Here’s the final version of the source:
+
++makeTabs(
+ `forms/js/app/hero-form.component.js,
+ forms/js/app/hero-form.component.html,
+ forms/js/app/hero.js,
+ forms/js/app/app.component.js,
+ forms/js/app/boot.js,
+ forms/js/index.html,
+ forms/js/styles.css`,
+ 'final, final,,,,,',
+ `hero-form.component.js,
+ hero-form.component.html,
+ hero.js,
+ app.component.js,
+ boot.js,
+ index.html,
+ styles.css`)
+:marked
diff --git a/public/docs/ts/latest/guide/forms.jade b/public/docs/ts/latest/guide/forms.jade
index bd8038eb80..7b8345d20a 100644
--- a/public/docs/ts/latest/guide/forms.jade
+++ b/public/docs/ts/latest/guide/forms.jade
@@ -44,13 +44,13 @@ include ../../../../_includes/_util-fns
We can lay out the controls creatively, bind them to data, specify validation rules and display validation errors,
conditionally enable or disable specific controls, trigger built-in visual feedback, and much more.
- It will be pretty easy because Angular handles many of the repeative, boiler plate tasks we'd
+ It will be pretty easy because Angular handles many of the repetitive, boiler plate tasks we'd
otherwise wrestle with ourselves.
We'll discuss and learn to build the following template-driven form:
figure.image-display
- img(src="/resources/images/devguide/forms/heroForm-1.png" width="400px" alt="Clean Form")
+ img(src="/resources/images/devguide/forms/hero-form-1.png" width="400px" alt="Clean Form")
:marked
Here at the *Hero Employment Agency* we use this form to maintain personal information about the
@@ -61,7 +61,7 @@ figure.image-display
If we delete the hero name, the form displays a validation error in an attention grabbing style:
figure.image-display
- img(src="/resources/images/devguide/forms/heroForm-2.png" width="400px" alt="Invalid, Name Required")
+ img(src="/resources/images/devguide/forms/hero-form-2.png" width="400px" alt="Invalid, Name Required")
:marked
Note that the submit button is disabled and the "required" bar to the left of the input control changed from green to red.
@@ -243,7 +243,7 @@ ol
Running the app right now would be disappointing.
figure.image-display
- img(src="/resources/images/devguide/forms/heroForm-3.png" width="400px" alt="Early form with no binding")
+ img(src="/resources/images/devguide/forms/hero-form-3.png" width="400px" alt="Early form with no binding")
:marked
We don't see hero data because we are not binding to the `Hero` yet.
We know how to do that from earlier chapters.
@@ -634,4 +634,4 @@ code-example(format="").
boot.ts,
index.html,
styles.css`)
-:marked
\ No newline at end of file
+:marked
diff --git a/public/resources/images/devguide/forms/hf-1.png b/public/resources/images/devguide/forms/hero-form-1.png
similarity index 100%
rename from public/resources/images/devguide/forms/hf-1.png
rename to public/resources/images/devguide/forms/hero-form-1.png
diff --git a/public/resources/images/devguide/forms/hf-2.png b/public/resources/images/devguide/forms/hero-form-2.png
similarity index 100%
rename from public/resources/images/devguide/forms/hf-2.png
rename to public/resources/images/devguide/forms/hero-form-2.png
diff --git a/public/resources/images/devguide/forms/hf-3.png b/public/resources/images/devguide/forms/hero-form-3.png
similarity index 100%
rename from public/resources/images/devguide/forms/hf-3.png
rename to public/resources/images/devguide/forms/hero-form-3.png