Reputation: 103
I am new to aurelia framework. I try to build a main menu with total 7 items. The first 4 items should be top menu items and the last 3 in a dropdown. I work with bootstrap 3.
the router config in the app.ts looks like:
config.map([
{ route: ['', 'Buchungen'],
name: 'Buchungen',
moduleId: './buchung/app-buchung',
nav: true, title: 'Buchungen',
settings: {img:'./img/ic_tab_buchungen_white.png',t:'main_Buchungen',class:'fa fa-money'}},
{ route: 'Konten',
name: 'Konten',
moduleId: './konto/app-konto',
nav: true,
title: 'Konten',
settings: {img:'./img/ic_tab_konto_white.gif',t:'main_Konten',class:'fa fa-university' }},
{ route: 'Bilanz',
name: 'Bilanz',
moduleId: './bilanz/app-bilanz',
nav: true,
title: 'Bilanz',
settings: {img:'./img/ic_tab_bilanz_white.gif',t:'main_Bilanz',class:'fa fa-balance-scale'} },
{ route: 'Erfolg',
name: 'Erfolg',
moduleId: './erfolg/app-erfolg',
nav: true,
title: 'Erfolg',
settings: {img:'./img/ic_tab_erfolg_white.gif',t:'main_Erfolg',class:'fa fa-line-chart'} },
{ route: 'Chart',
name: 'Chart',
moduleId: './child-router',
nav: true,
title: 'Chart',
settings: {img:'./img/chart_line32.png',t:'menu_chart',class:'fa fa-area-chart'} },
{ route: 'export',
name: 'export',
moduleId: './child-router',
nav: true,
title: 'export',
settings: {img:'./img/ic_menu_export.png',t:'menu_export', class:'glyphicon glyphicon-log-out'}},
{ route: 'option',
name: 'option',
moduleId: './child-router',
nav: true,
title: 'option',
settings: {img:'./img/ic_menu_export.png',t:'menu_option', class:'glyphicon glyphicon-option-horizontal'}}
]);
the nav-bar.html looks like:
<div class="collapse navbar-collapse" id="aaccounting-navigation-navbar-collapse">
<ul class="nav navbar-nav">
<li repeat.for="row of router.navigation" class="${row.isActive ? 'active' : ''}">
<a data-toggle="collapse" data-target="#aaccounting-navigation-navbar-collapse.in" href.bind="row.href" >
<i class="${row.settings.class}" aria-hidden="true"></i>
<span t.bind="row.settings.t">${row.title}</span>
</a>
</li>
In the above html there will be 7 menu items in a row, but I like to make the dropdown menu like:
<li>
<a href="#" data-toggle="dropdown" class="dropdown-toggle">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
</ul>
</li>
How can I do that with aurelia?
Upvotes: 1
Views: 540
Reputation: 2009
Perhaps, this answer is helpful for you: https://stackoverflow.com/a/38444441/4921289
His suggestion is to add properties to your route configuration settings properties (what you already did) to distinquish between dropdown entry or main entry.
Upvotes: 1