` and binding
its `hidden` property to the `HeroFormComponent.submitted` property.
+makeExample('forms/dart/lib/hero_form_component.html', 'edit-div', 'lib/hero_form_component.html (excerpt)')(format=".")
:marked
The main form is visible from the start because the
`submitted` property is false until we submit the form,
as the following code from `hero_form_component.dart` shows:
+makeExample('forms/dart/lib/hero_form_component.dart', 'submitted')(format=".")
:marked
When we click the Submit button, the `submitted` flag becomes true and the form disappears
as planned.
Now the app needs 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/dart/lib/hero_form_component.html', 'submitted', 'lib/hero_form_component.html (excerpt)')(format=".")
:marked
There's our hero again, displayed read-only with interpolation bindings.
This slug of HTML appears only while the component is in the submitted state.
The HTML includes an Edit button whose click event is bound to an expression
that clears the `submitted` flag.
When we click the Edit button, 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 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 reference variables such as `#heroForm`, `#name`, `#p`, and `#spy`.
- The `ngModel` directive for two-way data binding.
- The `ngControl` directive for validation and form element change tracking.
- The reference variable’s `valid` property on input controls to check if a control is valid and show/hide error messages.
- Property binding to disable the submit button when the form is invalid.
- Custom CSS classes that provide visual feedback to users about required invalid controls.
Here’s the code for the final version of the application:
+makeTabs(
`forms/dart/lib/hero_form_component.dart,
forms/dart/lib/hero_form_component.html,
forms/dart/lib/hero.dart,
forms/dart/pubspec.yaml,
forms/dart/web/index.html,
forms/dart/web/main.dart,
forms/dart/web/forms.css`,
'no-todo,,all,,,,',
`lib/hero_form_component.dart,
lib/hero_form_component.html,
lib/hero.dart,
pubspec.yaml,
web/index.html,
web/main.dart,
web/forms.css`)