mirror of
https://github.com/akveo/ngx-admin.git
synced 2026-01-11 12:08:51 +01:00
parent
0beef0b8a9
commit
ec0e5aa673
5 changed files with 20 additions and 21 deletions
|
|
@ -76,8 +76,12 @@ export class BaMenuService {
|
|||
}
|
||||
|
||||
// we have to collect all paths to correctly build the url then
|
||||
item.route.paths = parent && parent.route && parent.route.paths ? parent.route.paths.slice(0) : [];
|
||||
item.route.paths.push(item.route.path);
|
||||
if (Array.isArray(item.route.path)) {
|
||||
item.route.paths = item.route.path;
|
||||
} else {
|
||||
item.route.paths = parent && parent.route && parent.route.paths ? parent.route.paths.slice(0) : ['/'];
|
||||
item.route.paths.push(item.route.path);
|
||||
}
|
||||
|
||||
if (object.children && object.children.length > 0) {
|
||||
item.children = this._convertArrayToItems(object.children, item);
|
||||
|
|
@ -95,10 +99,6 @@ export class BaMenuService {
|
|||
|
||||
protected _prepareItem(object:any):any {
|
||||
if (!object.skip) {
|
||||
|
||||
let itemUrl = this._router.serializeUrl(this._router.createUrlTree(object.route.paths));
|
||||
object.url = object.url ? object.url : '#' + itemUrl;
|
||||
|
||||
object.target = object.target || '';
|
||||
object.pathMatch = object.pathMatch || 'full';
|
||||
return this._selectItem(object);
|
||||
|
|
@ -108,11 +108,7 @@ export class BaMenuService {
|
|||
}
|
||||
|
||||
protected _selectItem(object:any):any {
|
||||
if (object.children || object.pathMatch === 'full') {
|
||||
object.selected = object.url === ('#' + this._router.url);
|
||||
} else {
|
||||
object.selected = ('#' + this._router.url).indexOf(object.url) === 0;
|
||||
}
|
||||
object.selected = this._router.isActive(this._router.createUrlTree(object.route.paths), object.pathMatch !== 'full');
|
||||
return object;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue