I have applied same logic as given on answer of the Question No: 34486644 or see the link
How do I use a router and inbuilt/custom attributes to create dropdown menu in aurelia?
But the problem is it is showing "Route not Found".
In my JS File i have added:
Also,I have # in my app url [localhost/appname/#/modulename] Does the # is creating some problem ? If not then what is the issue ?
Code samples which i am using:
For dynamic route: moduleName.js
{
route: 'Services',
name: 'Services',
nav: true,
title: 'Services',
moduleId: 'App/modulename/compdemo1',
settings: {
subMenu: [
{ href: '#/ServicesSM1', title: 'Services 1' },
{ href: '#/ServicesSM2', title: 'Services 2' },
{ href: '#/ServicesSM3', title: 'Services 3' },
{ href: '#/ServicesSM4', title: 'Services 4' }
]
}
}
For HTML : modulename.html
<li repeat.for="route of router.navigation">
<!-- if route has no submenu -->
<a href.bind="route.href" if.bind="!route.settings.subMenu">${route.title}</a>
<!-- if route has submenu -->
<a href ="javascript:void(0);" if.bind="route.settings.subMenu">
${route.title}></a>
<!--<label if.bind="route.settings.subMenu">${route.title</label>-->
<ul if.bind="route.settings.subMenu">
<li repeat.for="menu of route.settings.subMenu">
<a href.bind="menu.href">${menu.title}</a>
</li>
</ul>
</li>