` and bind
its `hidden` property to the `HeroFormComponent.submitted` property.
The main form is visible from the start because the
`submitted` property is false until you submit the form,
as this fragment from the `HeroFormComponent` shows:
When you 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 HTML below the `
` wrapper you just wrote:
There's the hero again, displayed read-only with interpolation bindings.
This `
` 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 you click the *Edit* button, this block disappears and the editable form reappears.
## Conclusion
The Angular form discussed in this page 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.
- Handling form submission by binding to the `NgForm.ngSubmit` event property.
- Template-reference variables such as `#heroForm` and `#name`.
- `[(ngModel)]` syntax for two-way data binding.
- The use of `name` attributes 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.
- Controlling the *Submit* button's enabled state by binding to `NgForm` validity.
- Custom CSS classes that provide visual feedback to users about invalid controls.
The final project folder structure should look like this:
angular-forms
src
app
app.component.ts
app.module.ts
hero.ts
hero-form.component.html
hero-form.component.ts
main.ts
tsconfig.json
index.html
node_modules ...
package.json
Here’s the code for the final version of the application: