Analyze with AI

Get AI-powered insights from this Mad Devs article:

A migrated checkout can look identical while sending a company code that the user can no longer see. It can also show “valid” because a delayed check approved an earlier value. For a frontend lead moving an Angular Reactive Form to React against the existing API, visual similarity leaves the release decision unresolved.

This guide uses a hypothetical B2B checkout with card and invoice payment to define form validation parity. The example’s outcomes are expected behavior, not reported production results. You will build one acceptance protocol that gives QA identical inputs for both implementations and compares the screen, outgoing JSON, and server outcome before approving one form for release.

Key takeaways

  • Record the Angular form’s current behavior, then have the business rule owner approve the expected behavior before implementation.
  • Treat field visibility, retained local values, and submitted fields as separate decisions.
  • Bind every asynchronous validation result to the value it checked; client approval does not replace server validation.
  • Run the same four scenarios in Angular and React. Accept the form only when UI evidence, request data, and API outcomes satisfy the approved contract, including no order after rejection.

Define the form behavior you need to preserve

Start with the existing Angular form and its submission handler. Record the payment selection, company code, active validators, pending status, displayed error, and outgoing request for each scenario. This captures the baseline; it does not automatically make every existing behavior a requirement. Ask the process owner to distinguish rules users depend on from defects the migration should correct.

Our hypothetical checkout has two branches. Invoice payment requires a company code. Card payment hides that field and excludes its code from the request. Agree separately whether switching back to invoice restores the previous local value or clears it. Retaining a value for convenience does not authorize sending it with card payment.

Write three observations independently: what the user sees, which keys the browser submits, and what the API accepts or rejects. A screenshot cannot prove that a hidden code was omitted. A successful preliminary lookup does not establish whether the final order request will succeed.

Angular’s validation guide distinguishes synchronous validators from asynchronous checks. Inventory both, including cross-field validation that depends on the selected payment method. Agree when errors appear, such as after interaction or a submit attempt, without assuming the migration must change that timing.

External teams can contribute to this work: EbizON’s CrowdCuring case study describes platform work involving Angular and React. It provides engagement context, not evidence for this checkout’s rules or results.

Use Planning a phased frontend migration for broader migration context. Keep this acceptance contract focused on the form, and have backend engineers confirm the existing API’s required fields and rejection format.

Map Angular validation rules to the React form

Translate each rule into an observable React requirement before choosing implementation details. Conditional required validation means the company code participates in invoice validation and does not block card payment. Hiding an input alone does not establish either behavior. Make the active payment branch determine both the validation rules and the fields assembled for submission.

Check the project’s Angular version and actual submission code. The FormGroup API reference specifies that an enabled group’s value contains enabled controls, while getRawValue() includes disabled controls. A disabled group’s value includes all its controls. Consequently, disabling the company code and then submitting raw values can still send it. Record which method the existing handler uses; inspect the request rather than inferring serialization from the template.

In React, construct the payload explicitly. For this example, the relevant card fields are {"paymentMethod":"card"}; the invoice branch adds "companyCode":"B". Other checkout fields remain governed by the unchanged API contract. Decide whether local code retention survives switching branches, then test serialization independently of that choice.

For async validation, associate each request with the checked code and a unique request identity. When A is replaced by B, invalidate A’s authority to update the field. A late success or failure for A must not overwrite B’s status. In this example, invoice submission stays blocked while B is pending and becomes eligible only after B is approved and other active rules pass.

Finally, handle server-side validation errors on submission. If the server rejects B after the preliminary check succeeded, attach an understandable error to the code field, retain entered data, and allow correction. The backend must enforce the rule again; preliminary approval is no guarantee of acceptance.

Verify the migrated form with one acceptance matrix

Run the following inputs against both versions with the same API fixtures and starting checkout data. Reset between rows so one scenario cannot inherit another’s state. The matrix defines expected outcomes for this teaching example. It does not claim that either implementation has passed.

For reproducibility, fix error timing to the first submit attempt for an empty invoice code. Let both A and B have controllable preliminary responses, with A returning last. Make the final invoice request reject B in the last row. The JSON below shows only payment-related fields; compare the complete request against the agreed API contract as well.

ActionWhat the user seesSubmit and JSONExpected verification result
Enter a code in invoice mode, then select card and submit.The company code field disappears; card payment remains usable.Checkout request contains {"paymentMethod":"card"} and no companyCode key.API accepts the valid card fixture. No hidden code reaches checkout.
Select invoice, leave the code empty, and submit.The agreed required-field error appears on the code field.No checkout request; there is no submitted JSON.Required validation blocks invoice submission. No order is created.
Enter A, replace it with B, then return A’s response after B starts checking.B remains pending despite A’s response; only B’s result updates its status.No invoice checkout request while B is pending. After B passes, submit contains {"paymentMethod":"invoice","companyCode":"B"}.A is ignored. The accepted invoice fixture uses only B.
Approve B preliminarily, then reject B on final submission.A clear field error appears; entered checkout data stays available for correction.Request contains {"paymentMethod":"invoice","companyCode":"B"}; API returns the agreed validation rejection.No order is created. The user can correct the code and retry.

For each run, save the build identifier, fixture version, and response sequence with the evidence. Repeat the race with a late rejection for A as well as a late approval. Neither may change B’s current state.

Capture field state and errors alongside intercepted checkout requests and API responses. Distinguish preliminary lookup traffic from the order submission endpoint: “no checkout request” does not mean “no network activity.” Verify order state through the test environment’s authoritative order record, especially after rejection.

If Angular and React disagree, identify the violated rule and ask its owner to choose preservation or an intentional change. Record approval and update the expected test outcome before accepting changed behavior.

Decide whether the React form is ready to release

Release approval requires evidence for all four rows. A green preliminary validation indicator is insufficient when the final request contains the wrong code or the server rejection still produces an order. QA should retain the inputs, response ordering, visible states, request bodies, API responses, and order-state checks with the tested build identifiers.

Automate the browser-to-API boundary where these failures become observable. Intercept preliminary checks to hold B pending and deliver A late; assert that submission remains blocked. Then release B’s response and inspect the submitted body. Keep a separate integration check against a controlled backend fixture for final rejection and absence of an order. A mocked rejection alone cannot establish what the real backend persisted.

Link each defect to a matrix row and its business rule. A hidden companyCode in card JSON belongs to serialization; an obsolete A status belongs to response handling. This makes ownership and retesting specific. Backend engineers resolve API ambiguities, QA preserves reproduction evidence, and the product owner approves deliberate changes.

Treat any failing row as a release blocker for this example until corrected or replaced by an explicitly approved expectation. No execution artifact accompanies this example, so its release verdict remains unconfirmed. Keep broader route acceptance separate; Testing the first production route covers that wider boundary.

Conclusion

This hypothetical checkout is ready only when card submission excludes the company code, empty invoices cannot submit, late A responses cannot affect B, and final rejection creates no order. Those are acceptance conditions awaiting execution evidence. Choose one production form with a dependent field and a server-enforced rule, agree its expected outcomes, and run the matrix against Angular and React. Use the same evidence format to accept the next form.

Frontend Development
🤘 Move an Angular form without changing the rules users rely on
Bring the form where validation is hardest to reproduce. We’ll capture its Angular behavior, implement the React version against the current API, and show QA which outcomes match and which changes need product approval.
Discuss your migration

Latest articles here

CMS Migration Plan: How to Scope Content, Functionality, and Launch

CMS Migration Plan: How to Scope Content, Functionality, and Launch

A team decides to replace its CMS and asks for an estimate based on page count. Yet those pages depend on content types, templates, reusable...

How to Create a Design System for an Existing Product

How to Create a Design System for an Existing Product

A shared component changes once in a design file, yet the live product still requires fixes in several independent implementations. That symptom...

Phased migration from AngularJS to Angular through a controlled compatibility bridge

AngularJS to Angular Migration: How to Plan and Deliver a Phased Transition

An AngularJS application rarely stops changing while its replacement is being built. Customers still need fixes, product teams still request...

Go to blog