Improve this docA web application's main purpose is to present and gather data. For this reason Angular strives
to make both of these operations trivial. This example shows off how you can build a simple form to
allow a user to enter data.
Source
Demo
Things to notice
- The user data model is initialized
controller
and is
available in the scope
with the initial data.
- For debugging purposes we have included a debug view of the model to better understand what
is going on.
- The
input directives
simply refer
to the model and are data-bound.
- The inputs validate. (Try leaving them blank or entering non digits in the zip field)
- In your application you can simply read from or write to the model and the form will be updated.
- By clicking the 'add' link you are adding new items into the
user.contacts
array which are then
reflected in the view.