A contact form built with Angular 22 that sends submissions to your inbox through StaticForms.dev. There's no backend to write or host.
📖 Step-by-step tutorial: Getting started with Static Forms on the StaticForms blog.
- Standalone components (zoneless)
- Signals for form status
- Built-in control flow (
@if) scripts/write-env.mjsinjects the API key at build time- Loading, success and error states
- Shared styling with every other example in this repo
# From the monorepo root
pnpm install
cp apps/angular-example/env.example apps/angular-example/.env
# Add your API key to the new file, then:
pnpm dev:angularThe app runs on http://localhost:3006.
| Variable | Description |
|---|---|
NG_APP_STATICFORMS_API_KEY |
Your StaticForms.dev API key. Get one free at staticforms.dev. |
Locally, put it in .env. On Vercel, the deploy button asks for it; you can also add it later under Settings → Environment Variables.
The env file keeps your key out of git. Like the hidden
apiKeyfield in a plain HTML form, the key is still visible in the browser once the site is deployed.
Click Deploy with Vercel above. Vercel copies this repository into your account, sets the project's Root Directory to apps/angular-example and asks for NG_APP_STATICFORMS_API_KEY.
vercel.json in this folder installs only this example's dependencies from the monorepo. Output: Static (dist/angular-example/browser).
To deploy manually, import the repository at vercel.com/new, set Root Directory to apps/angular-example, add the environment variable, and deploy.
| Path | Purpose |
|---|---|
src/app/app.html |
Page layout |
src/app/contact-form/contact-form.ts |
Contact form logic |
src/app/contact-form/contact-form.html |
Contact form template |
scripts/write-env.mjs |
Writes the API key to src/env.generated.ts |
vercel.json |
Vercel deployment settings |
env.example |
Environment variable template |
The form POSTs JSON to the StaticForms API:
POST https://api.staticforms.dev/submit
Content-Type: application/json
{
"apiKey": "YOUR_API_KEY",
"name": "Jane Doe",
"email": "jane@example.com",
"message": "Hello!",
"replyTo": "@",
"subject": "New Contact Form Submission"
}"replyTo": "@" sets the reply-to address to the sender's email. The API responds with { "success": true }, or with { "success": false, "message": "..." } when something goes wrong.
From the StaticForms blog:
- Getting started with Static Forms
- Adding a contact form to a Jamstack site
- All StaticForms tutorials and guides
Docs:
MIT