- PrimeNG (https://primeng.org/) and Prime FLex (https://primeflex.org/) is already installed. You can utilize these libraries for convenience.
- You can also choose to not use it or choose own UI library for testing purposes.
Submit the assignment as a zip file in email.
As a user, I want to have a parent and child component interaction where:
- Child Component: The child component contains a form with fields for username, email, and mobile number, along with a submit button to submit the form.
- Parent Component: In the parent component, I can toggle the visibility of the email field in the child form by clicking a button.
- Component Display: The child component is displayed within the parent component, with clear visual separation between the two through basic styling.
As a user, I want the following validation rules applied to the child component’s form:
- Field Requirements: All visible fields in the child component should be required.
- Email Validation: The email field must have a valid email format.
- Mobile Number Validation: The mobile number field must have exactly 10 digits.
- Submit Button State: The submit button should be disabled if any validation fails.
As a user, I want to trigger form submission with the following behaviors:
- Mock API Error: When “test” is entered as the username, it should trigger a mock API error.
- Form Submission: Use the submitForm method to submit the form data.
- Parameter Update: Ensure the parameter type for the submitForm method is correctly updated.
- Button State: The submit button should be disabled after it’s clicked to prevent multiple submissions.
- Feedback Display: Show a success or failure message based on the form submission result.
- Emit on Success: If the submission is successful, emit the username to the parent component.