Skip to content

Commit

Permalink
feat(menu): add support for query parameters (akveo#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
mishkolesnikov committed Mar 26, 2018
1 parent 2ff3368 commit decf24a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<a *ngIf="menuItem.link && !menuItem.url && !menuItem.children && !menuItem.group && !menuItem.hidden"
[routerLink]="menuItem.link"
[fragment]="menuItem.fragment"
[queryParams]="menuItem.queryParams"
[attr.target]="menuItem.target"
[attr.title]="menuItem.title"
[class.active]="menuItem.selected"
Expand Down
2 changes: 1 addition & 1 deletion src/framework/theme/components/menu/menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export class NbMenuComponent implements OnInit, AfterViewInit, OnDestroy {

if (homeItem) {
if (homeItem.link) {
this.router.navigate([homeItem.link]);
this.router.navigate([homeItem.link], { queryParams: homeItem.queryParams });
}

if (homeItem.url) {
Expand Down
5 changes: 5 additions & 0 deletions src/framework/theme/components/menu/menu.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Observable } from 'rxjs/Observable';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { ReplaySubject } from 'rxjs/ReplaySubject';
import { share } from 'rxjs/operators/share';
import { Params } from '@angular/router';

export interface NbMenuBag { tag: string; item: NbMenuItem }

Expand Down Expand Up @@ -87,6 +88,10 @@ export abstract class NbMenuItem {
* @type {boolean}
*/
group?: boolean;
/** Map of query parameters
*@type {Params}
*/
queryParams?: Params;
parent?: NbMenuItem;
selected?: boolean;
data?: any;
Expand Down

0 comments on commit decf24a

Please sign in to comment.