mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-16 23:40:14 +01:00
feat(menu): highlight childless items when path matches
This commit is contained in:
parent
c6a9d67a83
commit
2d60a286d2
1 changed files with 6 additions and 1 deletions
|
|
@ -100,6 +100,7 @@ export class BaMenuService {
|
|||
object.url = object.url ? object.url : '#' + itemUrl;
|
||||
|
||||
object.target = object.target || '';
|
||||
object.pathMatch = object.pathMatch || 'full';
|
||||
return this._selectItem(object);
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +108,11 @@ export class BaMenuService {
|
|||
}
|
||||
|
||||
protected _selectItem(object:any):any {
|
||||
object.selected = object.url == ('#' + this._router.url);
|
||||
if (object.children || object.pathMatch === 'full') {
|
||||
object.selected = object.url === ('#' + this._router.url);
|
||||
} else {
|
||||
object.selected = ('#' + this._router.url).indexOf(object.url) === 0;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue