I find myself in a bit of a dilemma. I have created a component called Application.
In addition, I have several other components such as page1, page2, page3. These are all unique components with various validations and fields that users need to complete. My goal is to display these components sequentially within the Application component. For example, when a user applies for a new "loan," they are directed to the /application route where there is a breadcrumb component and various subcomponents like page1, page2, page3, each serving a different purpose such as personal information or financial details.
Now, my question is, what is the most effective way to manage the current page being displayed to the user? Currently, in the HTML code for the Application component, I am using a switch statement to toggle between displaying page1, page2, and page3. I also use an enum to track the current page so that when the user clicks 'continue' on one page, it advances to the next page based on the enum value. However, I am not entirely satisfied with this approach and would appreciate any suggestions for a better solution.
Below is a snippet from my Application HTML code:
<div class="ui-g">
<div class="ui-g-7 ui-md-offset-2">
<app-application-steps></app-application-steps>
</div>
</div>
<div class="ui-g">
<div class="ui-g-7 ui-md-offset-2" [ngSwitch]="activeStep">
<div *ngSwitchCase="'getting-started'">
<app-application-getting-started></app-application-getting-started>
</div>
<div *ngSwitchCase="'personal-details'">
<app-application-personal-details></app-application-personal-
details>
</div>
</div>
</div>
Each page is implemented as its own component due to their varying dependencies, validation requirements, and code complexity, which helps maintain a clean structure.
If you have any advice or tips on how to improve this setup, I would greatly appreciate it.
Thank you!