I'm trying to find a better approach to handle complex angular forms. The form has many cascading dropdowns, and I need to find an approach to reduce complexity.
Below Validations I'm trying to achieve:
- Based on the brand selected, I want to populate the related models and based on selected i want to populate Model types (Maker and Dealer sides).
- Based on user selected of the brand in Dealer side i should update the (Brand Maker) dropdown in top left e.g. if user selects AUDI in Dealer then the Brand Maker dropdown should be updated with which expected values BWM and Audi.
- There should be validation in Registration ID as user types and leave the field, e.g. user input is 12345657 an API will be called to check for existing Registration ID, if exisits it will prefill and lock the fields in Maker Side.
- If the user types certain Registration ID in Dealer side same api check shall be called and if the existing ID is returned, the fields will be prefilled and locked.
- in the Maker side chosen Model e.g. M3 make type and description values will be fetched from API and locked.
- If the chosen Model is M3 user input in Registration ID is validated via API e.g. user input is 15377347 if this is not in the system it shall disable the form submission.
- Both Maker and Dealer validations are interchangeble meaning if user login as AUDI the maker is Audi and Dealer is BMW and same validations when user has when login as BMW maker shall be valid in Dealer side. can you please elaborate what's the approach given the validations above,will be grateful if answers point to a tutorial or a stackblitz demo.