Create Event Form Setup

Let's create the form for creating events.

Now that all our modules and packages are set up, we can create our form.

This is our code so far:

Please provide values for the following:
your_API_key
Not Specified...
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>LetsGetLunch</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
  <app-root></app-root>
</body>
</html>
Google Maps API key

Update component

  1. Start by adding the following imports to EventCreateComponent:
    1. FormBuilder is a class that’s used to help us create the various controls, known as FormControls, within our form. These controls are a part of a FormGroup which in our case represents our entire form. So our form is composed of FormControls that are all a part of a FormGroup which we create using FormBuilder.

    2. MapsAPILoader is a part of AGM, which will be used to load the Google Places API.

Press + to interact
// src/app/event/event-create/event-create.component.ts
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MapsAPILoader } from '@agm/core';
  1. Now inject the FormBuilder and MapsAPILoader dependencies into our constructor
Press + to interact
// src/app/event/event-create/event-create.component.ts
export class EventCreateComponent implements OnInit {
eventForm: FormGroup;
constructor(private fb: FormBuilder, private gmaps: MapsAPILoader) { }
ngOnInit(): void {
}
}
  1. Along with the dependencies, create a property eventForm of type FormGroup. This is the
...