fix(menu): fix #84 page title and breadcrumb not showing up

This commit is contained in:
nixa 2016-07-14 12:05:05 +03:00
parent 77a13b5308
commit 8340acec7a
2 changed files with 27 additions and 4 deletions

View file

@ -4,6 +4,8 @@ import {Router, UrlTree, RouterConfig} from '@angular/router';
@Injectable()
export class BaMenuService {
protected _currentMenuItem = {};
constructor(private _router:Router) {
}
@ -12,11 +14,19 @@ export class BaMenuService {
return this._skipEmpty(items);
}
public getCurrentItem():any {
return this._currentMenuItem;
}
public selectMenuItem(menuItems:any[]):any[] {
let items = [];
menuItems.forEach((item) => {
this._selectItem(item);
if (item.selected) {
this._currentMenuItem = item;
}
if (item.children && item.children.length > 0) {
item.children = this.selectMenuItem(item.children);
}