Now let’s talk about a different scenario where we won’t always know how many fields or which fields we will have. There could be many scenarios for needing a dynamically built form. Let’s say that our application pulls data from that API for a form that we need to edit.
For this example, we are going to get a list of users and we need to edit their email. The process for this would look something like:
- Get an array of users from an API call
- Display this list to our administrator
- Provide fields to edit the information of our users
- Validate those fields using Angular
To keep things simple, instead of pulling a list of users from an API, we will be creating the array right in the JavaScript file. Easy cheese. Here is our list of users and we’ll be editing their email addresses.
Your new post is loading...