DropForm with Angular
Integrate DropForm into an Angular app using fetch or HttpClient. Includes template-driven example, loading state, inline errors, and file uploads.
This guide shows how to submit forms to DropForm from Angular using the Submission API endpoint: POST https://api.dropform.app/s/{uid}.
Angular can submit using:
- fetch + FormData (simplest)
- HttpClient (Angular style)
We’ll use FormData because it works for file uploads and keeps the payload simple.
What you need
- Your form endpoint:
https://api.dropform.app/s/{uid} - An Angular app
Angular example (template-driven + FormData)
This is a minimal template-driven form that submits with fetch. It includes loading state and inline status.
Component HTML
Component TypeScript
Using HttpClient (optional)
If you prefer Angular’s HttpClient, you can submit FormData the same way. Do not set Content-Type manually.
Example: HttpClient submit
JSON mode (optional)
If you don’t upload files, you can send JSON with Content-Type: application/json.
Example: JSON submit
File uploads
File uploads work automatically with FormData. If you want to guarantee JSON response mode for multipart uploads, include a data part with Content-Type: application/json.
Example: force multipart JSON mode (optional)
Common gotchas
- Don’t set Content-Type for FormData: the browser sets multipart boundaries.
- Handle 400 errors: DropForm returns JSON describing validation errors in JSON mode.
- Use redirect mode for simplest static forms: if you don’t need AJAX.
