You are given a partially scaffolded Angular 21 project. Your task is to implement two standalone components that work with employee profile data using Angular Reactive Forms.
A data service (EmployeeService) and model (Employee) are already provided. You must not modify the service or model.
Build an Employee Profile feature with two views:
| Route | Component | Purpose |
|---|---|---|
/view |
EmployeeViewComponent |
Display employee data in a read-only reactive form |
/edit |
EmployeeEditComponent |
Edit employee data and mock-save it |
- Inject
EmployeeServiceand callgetEmployee(1)on init. - Build a reactive form that mirrors the employee data structure.
- All form controls must be disabled (read-only display).
- The form must include:
- Text fields:
name,email - A
<select>bound viaformControlNamefordepartment - Checkboxes for each skill in
AVAILABLE_SKILLS— pre-check the ones the employee has - A
FormArrayforexperiences, each entry showingcompany,role, andyears
- Text fields:
- Show a loading indicator while data is being fetched.
- Include a navigation button/link to
/edit.
- Inject
EmployeeServiceand callgetEmployee(1)on init to pre-populate the form. - Build an editable reactive form with the same structure as the view form, but enabled.
- The form must include:
- Text fields:
name,email— both required emailmust use the built-inValidators.emailvalidator- A
<select>fordepartment— required - Checkboxes for each skill in
AVAILABLE_SKILLS— pre-check the ones the employee has - A
FormArrayforexperienceswith:company(required),role(required),years(required, min: 0)- An Add Experience button that appends a new empty group
- A Remove button per entry that removes it from the array
- Text fields:
- On submit:
- Validate the entire form — show validation errors inline
- If valid, call
employeeService.saveEmployee(...)and show a success message - If invalid, mark all controls as touched to reveal errors
- Include a navigation button/link back to
/view.