Build a contact form in Angular using Reactive Forms and HttpClient. FormsList handles the backend — no Express or NestJS server required.
TL;DR
To add a contact form to Angular, use Reactive Forms with HttpClient to POST form data to `https://formslist.com/f/your-form-id`. FormsList handles submissions — no Express or NestJS backend required.
Sign up for a free FormsList account and create a new form. Copy the endpoint URL from your dashboard.
// Your endpoint will look like this:
// https://formslist.com/f/YOUR_FORM_HASHGenerate a new component with `ng generate component contact-form`. Use ReactiveFormsModule to define a FormGroup with validators. The onSubmit method collects form values, builds a FormData object, and posts to FormsList via fetch.
// contact-form.component.ts
import { Component } from '@angular/core';
import { ReactiveFormsModule, FormGroup, FormControl, Validators } from '@angular/forms';
import { CommonModule } from '@angular/common';
@Component({
selector: 'app-contact-form',
standalone: true,
imports: [ReactiveFormsModule, CommonModule],
templateUrl: './contact-form.component.html',
})
export class ContactFormComponent {
status: 'idle' | 'sending' | 'sent' | 'error' = 'idle';
contactForm = new FormGroup({
name: new FormControl('', [Validators.required]),
email: new FormControl('', [Validators.required, Validators.email]),
message: new FormControl('', [Validators.required]),
});
async onSubmit() {
if (this.contactForm.invalid) return;
this.status = 'sending';
const formData = new FormData();
formData.append('name', this.contactForm.value.name ?? '');
formData.append('email', this.contactForm.value.email ?? '');
formData.append('message', this.contactForm.value.message ?? '');
try {
const res = await fetch('https://formslist.com/f/YOUR_FORM_HASH', {
method: 'POST',
body: formData,
});
if (res.ok) {
this.status = 'sent';
this.contactForm.reset();
} else {
this.status = 'error';
}
} catch {
this.status = 'error';
}
}
}Add the HTML template for your contact form component. Angular's reactive form directives bind the form controls to the template.
<!-- contact-form.component.html -->
<form [formGroup]="contactForm" (ngSubmit)="onSubmit()" class="space-y-4 max-w-md">
<div>
<label for="name" class="block text-sm font-medium">Name</label>
<input
id="name"
formControlName="name"
type="text"
class="mt-1 block w-full rounded border p-2"
/>
</div>
<div>
<label for="email" class="block text-sm font-medium">Email</label>
<input
id="email"
formControlName="email"
type="email"
class="mt-1 block w-full rounded border p-2"
/>
</div>
<div>
<label for="message" class="block text-sm font-medium">Message</label>
<textarea
id="message"
formControlName="message"
rows="4"
class="mt-1 block w-full rounded border p-2"
></textarea>
</div>
<button
type="submit"
[disabled]="status === 'sending' || contactForm.invalid"
class="rounded bg-blue-600 px-4 py-2 text-white hover:bg-blue-700 disabled:opacity-50"
>
{{ status === 'sending' ? 'Sending...' : 'Send Message' }}
</button>
<p *ngIf="status === 'sent'" class="text-green-600">Message sent successfully!</p>
<p *ngIf="status === 'error'" class="text-red-600">Something went wrong. Please try again.</p>
</form>Run `ng serve`, navigate to the page with your form, and submit a test message. Verify it appears in your FormsList dashboard. Enable email notifications, Slack integration, or auto-responders from the dashboard.
Build a fully functional contact form in React with hooks, validation, and email notifications. No backend server or API routes needed.
Learn moreLearn how to process form submissions on any website without writing server-side code. Use a form backend service to receive, store, and forward submissions by email.
Learn moreLearn the best practices for validating form data on both the client and server side. Improve user experience, reduce errors, and keep your data clean.
Learn moreSet up your form backend in under a minute. No server required, no complex configuration — just a simple endpoint for your forms.