feat(menu): highlight childless items when path matches

This commit is contained in:
Grzegorz Rozdzialik 2016-09-21 22:55:23 +02:00 committed by tibing
parent c6a9d67a83
commit 2d60a286d2

View file

@ -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;
}
}