I'm trying to link from one parent to another.
For example, from the below I want to link from one "Dashboard" to another "Dashboard"
When I link from "Home" to a Dashboard, all of the links work. They look like this:
<a [routerLink]="['/dashboard', dashboard.Id]">
However, when I'm in a dashboard and to link to another dashboard, the URL changes, but the dashboard stays the same.
<a [routerLink]="['/dashboard', nextdashboard.Id]">
If I refresh the page with the "next dashboard" URL, the "next dashboard" loads.
What am I doing wrong?
const appRoutes: Routes = [
{
path: '',
component: Home
},
{
path: 'dashboard/:id',
component: Dashboard,
children: [
{
path: 'Stores', component: StoresComponent
},
{
path: 'Websites', component: WebsitesComponent
}
]
}
]
Edit: In my Dashboard Component, I'm subscribing to the params. I'm also making a call to a service to get the new order. However, this only works when initially routed from Home, not from Dashboard to Dashboard.
When I console.log the ID, I don't see an update.
this.route.paramMap.subscribe(params => {this.Id = params.get('id')});
this.orderjson = this.dashboardService.getOrders().filter((obj) => obj.Id=== this.Id);