Add e-signatures and clickwrap to Angular
To add e-signatures and clickwrap to Angular, install esigncomply and @esigncomply/browser. The Express server that ng new --ssr creates holds the secret key and carries the session route, the confirm route and the document pages. A component attaches the browser SDK in afterNextRender. Esign Comply seals each acceptance as an independent record anyone can verify.
Follow the quickstart and each signature is a valid electronic signature under the U.S. ESIGN Act, state UETA laws and New York's ESRA, and each clickwrap is built the way courts require: clear notice of the terms, an unmistakable act of assent, and a sealed record of both.
$npm install esigncomply @esigncomply/browserFree plan: 10 live signatures a month and a full test mode. No card required.
Last updated
// Step 4: create the session with the secret key. The browser gets the client token only. api.post('/api/ceremony', async (req, res) => { // The page that runs the ceremony: the origin the browser reports, plus its path. const origin = req.get('origin') ?? `${req.protocol}://${req.get('host')}`; const { data: session, error } = await esc.sessions.create( { profile: process.env['ESIGNCOMPLY_PROFILE_ID']!, signer, documents: [ { document: DOCUMENTS['terms']!, version: 'current' }, { document: DOCUMENTS['privacy']!, version: 'current' }, ], context: { url: `${origin}/signup`, locale: 'en-US', purpose: 'account_signup' }, }, { idempotencyKey: `signup-${signer.external_id}-${randomUUID()}` }, ); if (error) return void res.status(502).json({ error: error.code }); pinned.set( signer.external_id, session.documents.map((d) => d.version_id), ); res.json({ clientToken: session.client_token, apiUrl: session.api_url, documents: session.documents }); });
constructor() { // This class also runs on the server while Angular renders the page. // afterNextRender runs in the browser only, once, when the form is in the DOM: one session per page load. afterNextRender(() => void this.start()); inject(DestroyRef).onDestroy(() => this.ceremony?.destroy()); } private async start() { try { // Your server creates the session and returns { clientToken, apiUrl, documents }. Never the secret key. const response = await fetch('/api/ceremony', { method: 'POST' }); if (!response.ok) throw new Error('We could not start the signup. Reload the page to try again.'); const session = await response.json(); const ceremony = await EsignComply.attach({ clientToken: session.clientToken, apiUrl: session.apiUrl }); this.ceremony = ceremony; ceremony.on('change', ({ remainingSteps }) => { this.canComplete.set(!remainingSteps.some((step) => step !== 'signature.applied')); }); // Point each link at the exact version this session pinned, wait for Angular to update the DOM, then report it. this.versions.set(session.documents.map((document: { version_id: string }) => document.version_id)); await new Promise<void>((resolve) => afterNextRender(() => resolve(), { injector: this.injector })); const [terms, privacy] = this.versions(); await ceremony.presentDocument({ versionId: terms, mode: 'hyperlink', link: this.termsLink().nativeElement }); await ceremony.presentDocument({ versionId: privacy, mode: 'hyperlink', link: this.privacyLink().nativeElement }); await ceremony.observeAssent({ region: this.assent().nativeElement, // notice, links, checkbox, button checkbox: this.checkbox().nativeElement, submit: this.submit().nativeElement, }); this.ready.set(true);
const app = express(); const angularApp = new AngularNodeAppEngine(); // The session route, the confirm route and the document pages. They hold the secret key. app.use(api);
// Step 6: confirm the record with the secret key before the account exists. api.post('/api/signup/confirm', json(), async (req, res) => { const { data: record, error } = await esc.records.get(String(req.body?.recordId)); const expected = [...(pinned.get(signer.external_id) ?? [])].sort(); const confirmed = !error && SEALED.includes(record.status) && record.livemode === LIVE && record.signer.external_id === signer.external_id && JSON.stringify(record.documents.map((d) => d.version_id).sort()) === JSON.stringify(expected); console.log(confirmed ? `confirmed ${record.id} (${record.status})` : 'refused'); if (!confirmed) return void res.status(409).json({ confirmed: false }); // Only now create the account, and store record.id and record.receipt with it. res.json({ confirmed: true, recordId: record.id }); });
How do you integrate Esign Comply with Angular?
An Angular app runs in the browser, so the secret key needs a server, and with server-side rendering Angular gives you one: src/server.ts, an Express app that ng serve runs too. The routes go there. The component's class also runs on that server, so it attaches the browser SDK in afterNextRender, which runs in the browser only.
Angular is a web framework that empowers developers to build fast, reliable applications that users love.
Source: Angular documentation, What is Angular?, read on .- Express routesrc/api.ts
- Componentsrc/app/signup/signup.ts
- server.tssrc/server.ts
- Confirm routesrc/api.ts
Run on 2026-11-26 with Angular 22.3.0 and server-side rendering (@angular/ssr 22.3.0, Express 5.3.0), in the app that ng new --ssr creates, esigncomply 1.0.4 and @esigncomply/browser 1.0.4 on Node.js 24.22.1, under ng serve (the conformance check from esigncomply 1.0.4) and as the built Node.js server (one ceremony), against the API in test mode.
What prompt adds Esign Comply clickwrap to a Angular app?
Paste this into Cursor, Claude Code or the AI coding tool that is open on your project. It names the packages that exist, where the secret key goes in Angular, what to build and what never to do, and it ends with the rules block for your project.
The rules block lives at /rules.md. Added to your project's instruction file, it makes every later session build signing and acceptance flows the same way. The prompt generator writes the long version, with your own document and profile IDs.
Pages for each AI toolAdd Esign Comply clickwrap to my Angular app: a signup form where the user accepts the Terms of Service and the Privacy Notice with a checkbox and a button.
Read these first and follow them exactly. If something conflicts with existing code, or you are unsure how to implement a step, stop and ask. Do not invent API methods, packages or legal wording.
- https://esigncomply.com/docs/quickstart/angular.md (the steps and the tested code for Angular)
- https://esigncomply.com/setup.md (the order of API calls)
- https://esigncomply.com/auth.md (how to handle the keys)
Angular facts
- Packages (the only ones that exist): esigncomply (server code, Node.js 20.19 or later) and @esigncomply/browser (the component). There is no Angular package.
- The app needs server-side rendering (ng new --ssr, or ng add @angular/ssr): its Express file src/server.ts is the only place for the secret key. Put the routes in a file that src/server.ts imports, and register them before the Angular handler. Never import that file from anything under src/app.
- The Angular CLI does not read .env. Start ng serve through node --env-file=.env, and add .env to .gitignore: ng new does not list it. Never print the key.
- Never read process.env in a component. The class also runs on the server, and with prerendering it runs at build time: the value ends up in a static HTML file.
- Server SDK calls return { data, error } and do not throw. Check error every time.
- Call fetch and EsignComply.attach inside afterNextRender only. After you set the signal that feeds the two link addresses, wait for the next render before presentDocument.
- The form is in the server HTML before the script loads. Keep the checkbox disabled until observeAssent has resolved.
- The built server answers 400 to a host that is not in security.allowedHosts (angular.json) or in NG_ALLOWED_HOSTS.
Build
1. Verify the key: GET /v1/usage with ESIGNCOMPLY_API_KEY. Stop if it fails.
2. Register the Terms of Service and the Privacy Notice as documents and publish one version of each from the documents in this project. If the project has none, register short sample documents and say so in your report. Never write or change the wording of the real documents. Create a profile: jurisdictions ["US-FED"], method "checkbox", assurance_level "L1".
3. src/api.ts, an Express Router that src/server.ts mounts: POST /api/ceremony creates the session with esc.sessions.create and an Idempotency-Key, saves the signer ID and the pinned version IDs in server-owned state, and returns only clientToken, apiUrl and documents.
4. GET /legal/:slug in the same router renders the registered version from esc.documents.versions.getContent inside <article data-esc-document>, unmodified.
5. src/app/signup/signup.ts, a component on the route /signup: in afterNextRender, EsignComply.attach({ clientToken, apiUrl }), presentDocument for each link, observeAssent({ region, checkbox, submit }) with viewChild elements, then ceremony.complete() in the submit handler. The checkbox has no checked attribute and no binding that ticks it.
6. POST /api/signup/confirm in the router reads the record with esc.records.get and requires: status is "recorded", "timestamped" or "anchored"; livemode is as expected; the signer ID and version IDs equal the server-owned state. Only then create the account.
Never
- Never pre-check the box, auto-submit, or call .click() on the user's behalf.
- Never use "By continuing" or "By clicking below" wording. The notice names the button by its label and each document by its registered name.
- Never put the secret key, or any call that uses it, in code that reaches the browser.
- Never show "signed" or "accepted" before the server has confirmed the record.
- Never fall back to an acceptance with no record when a session is refused.
Check before you report success
- Run: npx esigncomply check --url http://localhost:4200/signup --callback http://localhost:4200/api/signup/confirm
Fix every finding marked "block". List every finding marked "warn".
- Report the files you created or changed, anything you did not implement and why, and the conformance summary.
Then add the rules block to this project's instruction file: https://esigncomply.com/rules.mdWhat goes wrong when you add e-signatures in Angular?
These are specific to Angular. Each one was seen while the quickstart's code was run, or is in Angular's own documentation.
- 01
The built server answers 400 until your host is allowed
Source: Angular documentation, Security, read on .ng newwrites"allowedHosts": []intoangular.json, and Angular's server refuses aHostheader it does not know. In the test on Angular 22.3.0 the built server answered/signuponlocalhostwith400untilNG_ALLOWED_HOSTS=localhostwas set.ng serveanswered it without. List your production host before you go live. - 02
A component that reads process.env passes the build
The app's TypeScript settings include the Node.js types, so
process.envcompiles in a component. In the test,ng buildprerendered the page and the static HTML held the value from the build machine, and in the browser the same line threwReferenceError: process is not defined. Read the key in the server file only. - 03
The server HTML carries a checkbox the SDK does not watch yet
Angular sends the form as HTML before the script loads, and hydration keeps the same elements. In a test with the script held back, a box ticked in that HTML stayed ticked, and the browser SDK reported a
Source: Angular documentation, Hydration, read on .CR-01finding at Block level. The quickstart keeps the box disabled untilobserveAssenthas resolved.
Where are the Angular quickstart and the API reference?
Start with the quickstart: it carries every file this page excerpts, in the order you write them.
- QuickstartAngular quickstartStep by step, from install to your first sealed test record, with every file and the output of each step.Open
- ReferenceAPI referenceEvery endpoint, field and error code. Sessions, records and documents are the three this page uses.Open
- GuideServer confirmationThe one place access is granted: what to compare, and the webhook that backs the check up.Open
What does Esign Comply record for a signature in Angular?
The same record on every stack and platform. Your Angular code creates the session and confirms the record, and the browser SDK reports what happened on the page. Esign Comply seals the result where your code cannot change it. The record itself is described on Evidence and verification.
Observed and asserted fields
Every field is tagged. Observed is what the browser SDK and the API saw: the box unchecked at load, the tick from a trusted user event, the notice text, the terms version by hash, the server time. Asserted is what your app said, such as the user's email.
A signed receipt
complete()returns a receipt signed with ES256, using keys you do not hold. Your server stores it next to the user, andGET /v1returns it again./records /{id} /receipt An external timestamp
An outside authority timestamps the hash of every live record (RFC 3161), so the time on the record does not rest on your clock or on ours.
An offline verifier
Each record has an evidence report (PDF) and an evidence package (ZIP). Anyone you send the package to checks the acceptance with the open-source
esigncomply-verify, without an account.
Questions about e-signatures in Angular
Is there an Esign Comply SDK for Angular?
Yes, the two JavaScript packages, and no Angular bindings. The Express server of the app uses esigncomply, and a component calls @esigncomply/browser directly in afterNextRender. The browser SDK is headless, so it attaches to the template you wrote.
Where do I create the session in Angular?
In src/server.ts, the Express server that ng new --ssr creates, with esc.sessions.create. The quickstart puts the routes in src/api.ts and mounts them before the Angular handler. The route returns only the client token, the API URL and the pinned documents.
Does ng serve run the routes in src/server.ts?
Yes. In the test on Angular 22.3.0, ng serve answered POST /api and the document pages from the Express routes of that file, with no proxy and no second process. The Angular CLI does not read .env, so the quickstart starts it through node --env-file=.env.
Why does the component wait for a render before presentDocument?
Because a signal does not change the DOM at once, and the app ng new creates has no zone.js. In the test, without the wait the SDK requested the first link as /legal, with no version ID. The quickstart awaits afterNextRender after it sets the version IDs.
What happens when a component imports the server file?
The build stops. In the test, ng build failed with Could not resolve "node:crypto" when a component imported src/api.ts, because the browser bundle cannot hold the Node.js modules that esigncomply and Express use. The quickstart keeps that file outside src/app.
Build the signup in your own Angular app. Leave the record to us.
Free plan: 10 live signatures a month and a full test mode. No card required.
Angular is a trademark of its owner. Esign Comply is not affiliated with it. What this page says about Angular is from Angular's documentation or from a test run, as marked, on . /angular.md is this page as Markdown.