I have created 3 unique templates (DetailView, CardView, Column) for displaying content on a single page. Users can easily switch between these views.
My goal is to display only one view at a time on the page. When the user switches views, I want to remove the previous view and display the new one without having to fetch data from the server again. The data is already present in the Model for binding to the view, so no additional service calls are needed. I want this toggle between views to happen seamlessly without any page refresh or data loading.
The issue I am facing is that if I bind all three views, there could be conflicts with div IDs and there is a lot of HTML code for each view in the Document Object Model (DOM).
Can anyone suggest a solution for toggling between these different views without reloading the page? Here is an example of how the views are currently being included:
<body>
<div ng-include="'detailView.html'" ng-show="detailView"></div>
<div ng-include="'cardView.html'" ng-show="cardView"></div>
<div ng-include="'columnView.html'" ng-show="columnView"></div>
</body>