I have a menu with some buttons, when the user clicks on the menu, the page is directed to another page with list of buttons that have a link to another page.
Therefore my routing looks like this:
const routes: Routes = [
{
path: '',
data: {
title: 'Components'
},
children: [
{
path: 'departments/:fname',
component: DepartmentsComponent,
data: {
title: 'Departments'
},
children: [
{
path: '/:dname/modules',
component: ModulesComponent,
data: {
title: 'Modules'
}
}
]
},
]
}
];
So the user initially has the URL of:
components/departments/informatics
When the user clicks on any of the buttons inside the page, It should be directed to modules page with the parameter before it. For example:
components/departments/informatics/modules
Heree's how I do the routerlink:
<div class="row" *ngFor="let fac of _faculty">
<ul>
<li *ngFor="let dep of fac.Departments" class="checking">
<a routerLinkActive="active" [routerLink]="[department ,'modules']">
</a>
</li>
</ul>
I get: Error: Cannot match any routes. URL Segment
What am I doing wrong?