So I am currently working with ionic and angular. I am displaying 2 different types of users on a single page using ion-segment (artist and venue). The information for both users is being displayed on a card just the way I want it. When I click on the artist profile it's being displayed but when I click on the venue user it's displaying the HTML from the artist without the data. The id of the venue profile is correct it's just when brought to the profile it's not working the way I want. I feel the issue might be in the app-routing? but I'm not sure cause I've tried changing it and it's still not working.
discover.page.html:
<ion-card
*ngFor="let venue of relevantVenue.slice(1)"
fill="clear"
[routerLink]="['/','tabs','tab1','discover',venue.id]"
>
venue-details:
ngOnInit() {
this.route.paramMap.subscribe(paramMap => {
if (!paramMap.has('venueId')) {
this.navCtrl.navigateBack('/tabs/tab1/discover');
return;
}
this.venueSub = this.venueService
.getVenue(paramMap.get('venueId'))
.subscribe(venue => {
this.loadedVenue = venue;
});
});
}
ngOnDestroy() {
if (this.venueSub) {
this.venueSub.unsubscribe();
}
}
tabs-routing.module.ts:
const routes: Routes = [
{
path: '',
component: TabsPage,
children: [
{
path: 'tab1',
children: [
{
path: '',
loadChildren: () => import('../tab1/tab1.module').then(m => m.Tab1PageModule)
},
{
path: 'discover/:artistId',
loadChildren: () => import('../tab1/discover/artist-details/artist-details.module').then(m => m.ArtistDetailsPageModule)
},
{
path: 'discover/:venueId',
loadChildren: () => import('../tab1/discover/venue-details/venue-details.module').then(m => m.VenueDetailsPageModule)
}
]
},
path: 'discover/:artistId'
path: 'discover/:venueId'
These paths both use the same parent (parent being "discover"). Therefore there is a conflict in the routes. when it is to discover-artist / discover-venue it should work just fine.
After thats done change:
[routerLink]="['/','tabs','tab1','discover',venue.id]"
To:
[routerLink]="['/','tabs','tab1','discover-venue',venue.id]"
and same for discover-artist