A bit of a code structure question for Angular. I’m trying to achieve a split screen design, where the left and right show different data, based on different queries. The left will usually dictate which data on the right is display.
For example: The left will have a list of Artists. When clicking on an artist, a list of their albums will appear on the right. One approach that worked, but doesn’t feel quite right is the following:
A “screen one” component that has access to the URL params. Inside this component / module we import the Artists component and the Projects component. The screen one component handles the queries to Firestore and hands them down to these components:
<div>
<app-artists [artistsArray]="artistsArray"></app-artists>
<app-albums [albumsArray]="albumsArray"></app-albums>
</div>
This works pretty well. However, this will appear at the route /artists
. When clicking on an artists, the route would then be /artists/:artistID
. The tricky part here, is that in my routing module, i now have two routes that load the exact same module. Is that an issue?
Routing
const routes: Routes = [
{
path: 'artists',
loadChildren: () => import('./screens/screen-one/screen-one.module').then(mod => mod.ScreenOneModule),
},
{
path: 'artists/:artistID',
loadChildren: () => import('./screens/screen-one/screen-one.module').then(mod => mod.ScreenOneModule),
},
];