Chapter 4. Validating Forms and Making HTTP Requests

In this chapter, we will cover the following tasks related to creating form input validation, mocked API calls, and payment pages using Stripe:

  • Creating a complex form with input validation
  • Retrieving data via a mocked API using a static JSON file
  • Integrating with Stripe for online payment

Introduction

All mobile apps require taking user input and sending it to a backend server. A simple example is filling out a form, such as a user registration or contact form. The information is validated against a set of rules before being sent to the backend. Also, there are many other scenarios where the information is captured based on user behavior from the app, such as where they touch or how much time they spend on a certain page. Regardless, you will run into many send and retrieve data scenarios.

This chapter will cover the following three basic examples:

  • How to validate user inputs, such as text, number, and required versus not required, and communicate the data to another page
  • How to render data without having an actual backend
  • How to process payments using Stripe

All of these are actually available natively in Angular 2. However, since Angular 2 has a lot of changes compared to Angular 1 in terms of processing data and working with the backend server, it's worth covering these topics in detail.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.195.204