diff --git a/src/app/app.menu.ts b/src/app/app.menu.ts index 1d75bc06..5de1e553 100644 --- a/src/app/app.menu.ts +++ b/src/app/app.menu.ts @@ -1,7 +1,7 @@ export const menuItems = [ { title: 'Dashboard', - component: 'dashboard', + path: '/pages/dashboard', icon: 'fa fa-home', selected: false, expanded: false, @@ -9,7 +9,7 @@ export const menuItems = [ }, { title: 'Charts', - component: 'charts', + path: '/pages/charts', icon: 'fa fa-bar-chart', selected: false, expanded: false, @@ -17,13 +17,13 @@ export const menuItems = [ subMenu: [ { title: 'Chartist.Js', - component: 'chartist-js', + path: '/chartist-js', }, ] }, { title: 'UI Features', - component: 'ui', + path: '/pages/ui', icon: 'fa fa-laptop', selected: false, expanded: false, @@ -31,25 +31,25 @@ export const menuItems = [ subMenu: [ { title: 'Typography', - component: 'typography', + path: '/typography', }, { title: 'Buttons', - component: 'buttons', + path: '/buttons', }, { title: 'Icons', - component: 'icons', + path: '/icons', }, { title: 'Grid', - component: 'grid', + path: '/grid', }, ] }, { title: 'Form Elements', - component: 'forms', + path: '/pages/forms', icon: 'fa fa-pencil-square-o', selected: false, expanded: false, @@ -57,17 +57,17 @@ export const menuItems = [ subMenu: [ { title: 'Form Inputs', - component: 'inputs', + path: '/inputs', }, { title: 'Form Layouts', - component: 'layouts', + path: '/layouts', }, ] }, { title: 'Tables', - component: 'tables', + path: '/pages/tables', icon: 'fa fa-table', selected: false, expanded: false, @@ -75,13 +75,13 @@ export const menuItems = [ subMenu: [ { title: 'Basic Tables', - component: 'basictables', + path: '/basictables', } ] }, { title: 'Maps', - component: 'maps', + path: '/pages/maps', icon: 'fa fa-map-marker', selected: false, expanded: false, @@ -89,19 +89,19 @@ export const menuItems = [ subMenu: [ { title: 'Google Maps', - component: 'googlemaps', + path: '/googlemaps', }, { title: 'Leaflet Maps', - component: 'leafletmaps', + path: '/leafletmaps', }, { title: 'Bubble Maps', - component: 'bubblemaps', + path: '/bubblemaps', }, { title: 'Line Maps', - component: 'linemaps', + path: '/linemaps', } ] }, @@ -114,11 +114,11 @@ export const menuItems = [ subMenu: [ { title: 'Login', - url: '#/login', + path: '/login', }, { title: 'Register', - url: '#/register', + path: '/register', } ] }, diff --git a/src/app/theme/components/baSidebar/baSidebar.component.ts b/src/app/theme/components/baSidebar/baSidebar.component.ts index 89eef900..7241714b 100644 --- a/src/app/theme/components/baSidebar/baSidebar.component.ts +++ b/src/app/theme/components/baSidebar/baSidebar.component.ts @@ -1,10 +1,9 @@ -import {Component, ElementRef, HostListener, ViewEncapsulation} from '@angular/core'; -import {Router} from '@angular/router'; - -import {AppState} from '../../../app.state'; -import {layoutSizes} from '../../../theme'; -import {BaSlimScroll} from '../../../theme/directives'; -import {BaSidebarService} from './baSidebar.service'; +import {Component, ElementRef, HostListener, ViewEncapsulation} from "@angular/core"; +import {Router} from "@angular/router"; +import {AppState} from "../../../app.state"; +import {layoutSizes} from "../../../theme"; +import {BaSlimScroll} from "../../../theme/directives"; +import {BaSidebarService} from "./baSidebar.service"; @Component({ selector: 'ba-sidebar', @@ -35,7 +34,9 @@ export class BaSidebar { private _state:AppState) { this.menuItems = this._sidebarService.getMenuItems(); - // this._onRouteChange = this._router.root.subscribe((path) => this._selectMenuItem()); + this._onRouteChange = this._router.events.subscribe(() => { + this._selectMenuItem(); + }); this._state.subscribe('menu.isCollapsed', (isCollapsed) => { this.isMenuCollapsed = isCollapsed; }); @@ -49,7 +50,7 @@ export class BaSidebar { } public ngOnDestroy():void { - // this._onRouteChange.unsubscribe(); + this._onRouteChange.unsubscribe(); } public ngAfterViewInit():void { diff --git a/src/app/theme/components/baSidebar/baSidebar.html b/src/app/theme/components/baSidebar/baSidebar.html index cdb4d344..c8956c7e 100644 --- a/src/app/theme/components/baSidebar/baSidebar.html +++ b/src/app/theme/components/baSidebar/baSidebar.html @@ -4,10 +4,10 @@ [ngClass]="{'selected': item.selected && !item.expanded, 'with-sub-menu': item.subMenu, 'ba-sidebar-item-expanded': item.expanded}"> - + {{ item.title }} - + {{ item.title }} @@ -31,17 +31,17 @@ [ngClass]="{expanded: subitem.expanded, 'slide-right': subitem.slideRight}">