Saving Data with a Form

It’s great that our application is able to list bundles that already exist, but what about adding new ones? The right tool for this job is the venerable HTML <form> tag. Using a form, we can capture user input and process it by making a proxied call to the back-end APIs. Since the form is static HTML, we’ll put it in app/templates.ts. Open that file now and add this template.

​ ​export​ ​const​ addBundleForm = Handlebars.compile(​`​
​ ​ <div class="panel panel-default">​
​ ​ <div class="panel-heading">Create a new bundle.</div>​
​ ​ <div class="panel-body">​
​ ​ <form>​
​ ​ <div class="input-group">​
​ ​ <input class="form-control" placeholder="Bundle ...

Get Node.js 8 the Right Way now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.